« first day (3096 days earlier)      last day (1853 days later) » 

2:10 AM
cbg
 
 
1 hour later…
3:19 AM
cbg
Anyone have some experience of development ChatBot?
 
 
1 hour later…
4:39 AM
stackoverflow.com/questions/55564692/… duplicate of stackoverflow.com/questions/4731999/…, incorrectly reopened. The only answer is to use JavaScript, which the duplicate covers.
 
@davidism hammered
 
thanks
I managed to submit an edit right as you hammered, and it somehow recorded two partial edits.
 
@FrankAK some limited experience with Stack Overflow chat but I guess you probably want Discord or Slack
 
I see that... weird that closure causes two separate edits to be logged in the edit history
 
5:08 AM
@tripleee I have checked this docs.genesys.com/Documentation/BGS, but seems I need to buy they service, I'd like to build a websocket gateway for my chatbot myself.
 
@FrankAK not an area I'm familiar with, sorry
 
Thank you anyway :)
 
5:24 AM
 
5:53 AM
Don't think it's worth reopening... it's a duplicate with a really terrible title that has nothing to do with the actual problem
 
Hi everyone, I am using pandas to calculate mean for a particular column of a dataframe
There are some null values in that column
Does the mean calculated take those into account or is it calculating mean only till it encounters one of the null value as in Excel?
What I mean is say there are values 1,2 , 3 and null
will it then give 6/3 = 2 or 6/4 = 1.5?
 
6:11 AM
should be easy enough to determine experimentally, right?
 
yeah I think its the former
I just saw a documentation
Its supposed to skip nans by default
Just a quick question off topic guys, is it worth learning MATLAB along with python for the purpose of data analysis?
 
@RaphX depends on a lot of things, if it's an environment you like or which gets used a lot around you, go ahead
if I had to pick one I'd probably choose R first but I don't have a lot of insight into either
 
Cool, I guess I will go for python for now since most people around use that. Also, I am not that familiar with MATLAB and R at the moment. Thanks for the suggestion@tripleee
 
MATLAB is hella expensive
 
Yeah, I agree @AndrasDeak
 
6:45 AM
Hi
def removefirstlastchar(x): # creating a function to remove firt and last characters in the columns
value = str(x) # converting into string and assigning into variable value
if value.lower() == 'NAN'.lower(): # using if condition to check whether it has NAN and check a case insensitive match for 'NAN'.
return x
if(value[0].isalpha() == True): # check whether the fist value is character
value = value[1:] # if first value is character then it will remove and assign back to value
if(value[-1].isalpha() == True): # check whether the last value is character
Guys anyone can tell me whether the above code is correct or not?
 
it would be easier if you formatted it correctly
 
I have to clean the columns which has characters and its type is object.. ex: S23L, 45L, .. I need to remove the characters and keep only the number
def removefirstlastchar(x):
def removefirstlastchar(x):
value = str(x)
if value.lower() == 'NAN'.lower():
return x
if(value[0].isalpha() == True):
value = value[1:]
if(value[-1].isalpha() == True):
value = value[:-1]
return float(value)


df.iloc[:, 74:92] = df.iloc[:, 74:92].apply(removefirstlastchar)
this is my code
 
still not formatted, so i have no clue how those ifs are nested
 
Take non-nan rows and strip the non-numbers with regex?
Then you don't need apply
 
I tried with regrex it's nowt working
 
6:51 AM
Oh, not working, I see
 
this is my column
I need to remove the character and keep NAN as it is
 
Well run your code and check if it's correct or not
 
I have 10 columns.. if I run my above code for one column it works.
any suggestion please
I tried for more than 4 hours it's not working
 
@Jason and please don't paste walls of crap like that. Use a code paste service like pastebin.
 
sorry
Any suggestions?
 
7:00 AM
@Jason if you have a concrete question about code, you need to make it available in a form which doesn't break it; there is as link to an instruction in the starred messages on the right
or you can paste it somewhere like repl.it or ideone.com and link to that where you and we can run your code and experiment with it
hmmm wait, the code formatting message has scrolled off ...
the df looks like you are asking about numpy or pandas; generally a good idea to spell out what exactly you are using if it's not part of the standard library
 
i typed my code in ideone.com. But I dont how to link the same
Yes this is regarding pandas and numpy. df is my dataframe.
 
every ideone.com snippet has a URL which you can copy/paste; the ideone.com page also contains a box with that information in a prominent position so I don't know how you could have missed it
if you are logged in to ideone.com, the "my codes" menu also shows the URL for each item you have created
screen shot: i.stack.imgur.com/zFLQhm.jpg (sorry if it's too big)
 
This is my ideone link. Kindly check and advise please
 
'NAN'.lower() is kind of silly; why not hardcode 'nan'? (though I guess Python can optimize this=)
the error message looks like df is not actually a dataframe -- how are you creating it?
though I'm not a Pandas person (yet ...)
maybe see if you can update that to a proper MCVE
 
7:15 AM
I have csv file.. Which I need to clean.. so I am importing csv file and stored in dataframe and I named it as df
 
> how are you creating the variable df
 
its dataframe.. I can create any name..
this my code --
filename = ('assignment1_data.csv')
df = pd.read_csv(filename)
csv file assigning to df
 
7:42 AM
your code woirks fine for me with an input file like this:

depression_adult
O15.5
NaN
NaN
NaN
NaN
15.4K
etc
(dunno if the result is what you expect, but I don't get the error you report)
 
I want result like this 15.5, NAN,NAN,NAN,NAN, 15,4 etcc.. Second I would like to apply for all columns.. code works fine for one colum. when I tried to pass this to all columns its not working
 
without a good sample it's impossible to say whether the iloc does what it's supposed to do
but again the error message in your ideone looks like somehow your CSV file was in the wrong format or ... something
 
is any other way I can send my file?
 
which we cannot repro without a sample of at least a couple of lines (probably reduced to something as simple as possible which still reproduces the problem)
@Jason refactor the ideone.com example to one which actually runs, and reproduces your problem
 
ok
do you want me to send what I am expecting and what my CSV looks like?
 
7:49 AM
if you can repro the error message when you click "IdeOne it" that's good enough for now
 
ok
@tripleee If I have a string in python (like this 12P, Q45, NAN, 34) how to convert into float?
in python
 
you can't, because it's not a float
 
that's not a well-defined question, do you mean how can you remove the text?
 
yes remove the text and convert into float
is it possible to use regex or replace to remove the characters?
 
first google hit
notice that some of the solutions are for Python 2 though
regex is certainly one option, though perhaps overkill
trimmed = re.sub(r'^\D*(\d+)\D*$', r'\1', original)
that one won't touch fields which don't contain any numbers, so should trivially bypass your NaNs
 
8:01 AM
I am reading the stackoverflow.. but the thing how to implement for all the coulmns. I got around 19 columns
 
I checked.. but not getting solution
 
you don't understand what it says, or the code doesn't do what it's supposed to?
 
I have 18 columns which dtype is object.. I created function and passing this function to these 18 columns through iloc.. But it's not working..However, If I pass the function one by one column it works..
I am breaking my head what went wrong? my code is correct.. but some problem in passing to all columns.. if code is not correct then it wont clean the column one by one.
 
MCVE or bust.
tripleee's wasted quite some time trying to help and you're not getting anywhere. Produce a piece of code that you want to ask specific questions about.
 
8:10 AM
^ that
 
Sam
Morning all, I have a script which manipulates a web page using Selenium. Sometimes, the web page freezes while trying to retrieve data. This page freezing mostly just takes a little longer than usual to collect the data after which execution returns to normal. But, in some cases, the web page gets stuck and requires me to refresh the page to return to a stable state. In terms of handling this, could someone please check my current implementation and tell me if it seems reasonable?
Here is a minimal example of my implementation repl.it/repls/PepperyInvolvedLinkedlist. Thanks in advance!
The idea is that, after 9 seconds, I will conclude that the page is "completely frozen" and will require a refresh
 
8:29 AM
I'm going back to sleep
 
Sam
Lol! Get a coffee ;)
 
Morning guys ! I need your help. I'm making an web app in flask. I am at a point when I can generate the urls, but I don't know how to zip & download them now. I kinda have to piece it all together. Anyone that could help me ?
 
Sam
zip and download urls?
 
yes Sam
 
you seem to miss a paragraph about what these URLs are, Flask generally is used to create web apps (i.e. an URL runs a Flask function, not the other way around) but you seem to have some other use case in mind
 
8:36 AM
i mean jpg from urls
 
Sam
I'm not sure I follow what you mean
 
you really have to explain this in more detail ... does Flask sit on a bunch of images and you want to serve them zipped? or do you want Flask to fetch an image from somewhere?
 
Triplee, Sam, I need flask to fetch them from somewhere, sorry for confusing you guys
 
Sam
So you won't actually be downloading a URL. You want to download the data retrieved from a call to a specific URL
 
so we are back to "I have code which should do something which I will not explain in more detail and in fact I don't show you the code either!"
 
8:39 AM
:D :D guys, I'm sorry pretty new to python and coding at all :)
 
So your flask app will download a file from an url and then serve that file to the client? Why don't you just redirect the client to that url and let them download the file?
 
Sam
You need to provide some context and/or code. At the moment we are just speculating
 
Aran-Fey - Yes, the flask app will download a file from an url and then serve that file to the client. Because there's multiple .jpg under a single filename, so for FILENAME.jpg there's sometime 1 sometime 7 pictures
 
Sam
So do you want to return multiple files or a single file?
 
pastebin.com/vcu2H4XN - here is the code to the app you guys can this code on input to have an idea of what it looks like NWSUWJ-MR
Sam, multiple :(
 
Sam
8:51 AM
if you go to each of these URLs.. does it show a webpage with the image or initiate a download of said image?
 
Sam, it shows an image but again, going and downloading one by one would be too much for the user
 
Sam
have you looked at send_file ?
 
there's from 1 to 7 jpg's for every single product code
 
And you want to download all of those, zip them, and then send that zip to the client?
 
Aran-Fey yes !
or, do I need to actually download them ? Can't user download them himself ?
 
8:59 AM
I'm not aware of a HTTP status code that would let you tell the client "hey, go download all of these files"
 
Sam
@AnotherUser31 gist.github.com/philfreo/b307afd2339767481426. may be of interest. This code grabs one image and serves it as an attachment, but you should be able to incorporate it into your loop.
 
Hi, just started learning Python.
 
Sam
o/
 
@Sam interesting, so it uses request to download files ? what does that mean as attachment ? how the client would receive the file ? no zip like a bunch of jpgs ? and a lot of windows opened or how is this gonna work ?
@Aran-Fey hmmm...so that means I have to download them too ? like somewhere on the server or so ? a bit confused :(
 
Sam
@AnotherUser31 Can you give me some example URLs to this tennis website. I'll see if I can whip something together. Also note Aran-Fey's comment above. It seems an unusual request
 
9:10 AM
@Sam sure - here : img.tenniswarehouse-europe.com/new_big/NWSUWJ-MR-7.jpg just change the number from 1 to 7 .jpg
 
Sam
Cool.
 
9:25 AM
this looks like the blueprint stackoverflow.com/questions/20943224/…
you probably want to try to download the images in parallel if you can, but that's a bit more challenging
though these days maybe I would look for an async solution
 
@Aran-Fey I was just about to downvote that answer, but the author deleted it before I had the chance. ;)
 
@tripleee ohhh, interesting - didn't thought it would be that complicated in the end :(
 
Newest version of PyCharm lets you debug yupyter notebook kernels, this makes the notebook substantially more useful.
 
can you use pycharm with notebooks? :o
can I use it with my colab notebooks? or that's too much
 
The new UI connects to the jupyter server, and displays the results inside pycharm
It solves the debugging issue, that, at least to me, made juypter completely unusable.
 
yeah but does it work with colab?
I understand that works with local servers
 
I can connect to my GPU clusters at "work", will probably work for what you're doing
 
:o
in my experience, this is not the correct chat to do that sort of things
 
9:56 AM
ASCII art is ok, in small doses, if it's entertaining.
 
Ya'll just jealous of how much tensor I can flow on this thing
 
Maybe... My desktop machine is an ancient 32 bit single core thing with no GPU. I suppose I should get something a little more modern...
 
@Mikhail ufff
 
cabbage
 
10:07 AM
@shaan26 welcome
 
How to use dataclass in python?
 
Was the documentation not helpful?
 
No , I mean , couldnt understand it , looking for a dumbed down version
 
also putting the same question in google
 
Dumbed down version of what? The whole dataclasses module documentation?
 
10:15 AM
I just caught the Real python article, I think that would help..
 
10:34 AM
I'm starting to use Black for auto formatting and I've got a question: does Black obviate the need for flake8?
I've been using flake8 but it seems like, if one turns formatting issues over to Black, flake8 becomes redundant as a tool
 
most of that sounds reasonable
I don't know if there may be syntactical things that flake8 is about
 
cheers. an article I read (ljvmiranda921.github.io/notebook/2018/06/21/…) noted that using Black and flake8 together meant ignoring some flake8 warnings.
 
11:01 AM
@Anarach The "How" should be straight forward
from dataclasses import dataclass
@dataclass
class MyContainer:
  id: int
  content: str
The "why" would be more interesting probably. Can you link the article that you mean?
 
@tripleee quit slacking :P
 
@AndrasDeak do you mean I should answer that, or that I should find better questions to answer?
 
you should get a hammer!
and then install poke's hammer warning userscript and ask for a retag for questions like that one
 
I've had a gold badge in for a few years so I am aware of the implications
although the Python community seems more lenient towards near-duplicates than I'm used to
 
@tripleee right
 
11:35 AM
answering Python questions just to get the required couple of final votes is seriously impeding my day work (-:
 
fixed :P
 
@AndrasDeak wow, thanks! (-8
SOCVR is pretty clearly against requesting retagging just to get to hammer something; I would be pretty hesitant to use that
 
most posts should only have the main tag anyway
 
I imagine I will be hanging out here more now with clarifying questions to help me adapt to the tag's culture ... but I have a few questions on my list which I definitely plan to hammer when I get some time off
@AndrasDeak right, ack
I think I have asked before about inviting Queen here to notify about duplicate nominations and that it was rejected?
 
yup
 
11:46 AM
I'd rather not have a bot spamming cv-pls all the time... but I suppose I could just block it
 
Nah, it was deemed too disruptive. Unfortunately most regulars don't take much part in moderation, but that's that.
 
@AndrasDeak I can set that up in the SOBotics room just as well, not a problem
 
yeah, I was about to suggest that
there's also a dupe room
 
@AndrasDeak oooh thanks, that's useful
 
that's too bulky it seems
Subscribing to a few tags in sobotics might be better, though I don't know how they like that. I think there aren't many dupe suggestions there, but maybe only due to a lack of interested hammers.
 
11:51 AM
... just as I ran out of close votes for today!
@AndrasDeak the room is quite full of notifications so I don't think that would be a problem; but I can add a ping for Python questions in the dupes room just as well since they are being posted there already anyway
in fact I might also want to remove Queen from the Bash room
 
hmm, I guess, yeah
 
m8_
Morning! Can anyone suggest a few good NLP tutorials?
 
intuition tutorials or more technical ones?
also, it depends on your background
 
m8_
12:09 PM
No idea what intuition tutorial is
I'll just resort to whatever I find on Google. Thanks
 
From context I guess intuition = intuitive, aka giving a broad understanding of the ways in which the tech ought to be used, without necessarily getting into the nuts & bolts of the syntax/api/whatever
 
12:22 PM
also do you mean a proper linguistic tutorial or "I have no idea about language, I just want machine learning to magically solve my problem"?
 
When I'm not sure whether the querent wants a magical solution, I assume that they don't, because there are no magicians here and surely the querent must know that.
 
a lot of machine learning is approached like that these days, and sometimes it works if somebody else already figured out suitable models and parameters for your problem
 
@tripleee All Python questions should have the generic , unless they're rubbish that deserves to die in obscurity. Dupes that are worth keeping certainly should be retagged, not merely to make it easier to hammer them.
 
@PM2Ring right, definitely makes sense
 
cabbage
 
12:31 PM
feels more like Brussels sprouts here really, frankly
 
@Kevin My opinion of this room has been lowered by this pronouncement.
 
i have a public google sheet with 2 sheets https://docs.google.com/spreadsheets/d/14hFn00O9632n96Z2xGWvfrcY-K4kHiOGR02Rx7dsj54/edit#gid=447738801
I know how to wget if it has only 1 sheet, but is there a simple way of getting sheet1 and sheet 2 as a file in python (maybe csv)
 
@tripleee Let's not being the Belgians into this.
 
@toonarmycaptain We don't do magic here, just sufficiently advanced technology.
 
@PM2Ring Touche. My rabbit cries in her hat.
 
12:37 PM
My grandpa loved Brussels sprouts. I don't mind them in small doses, cooked with nutmeg and served with sour cream.
 
@PM2Ring I've never been a fan, but that sounds good :)
 
highly skeptical that nutmeg and sour cream is enough to do magic
 
@toonarmycaptain Unrelatedly, I notice that many prominent wizards will deny that they are wizards at all. Not that that has anything to do with me. [cough]
 
I couldn't resist posting this:
"That's no moon"—Kenobi, O. — PM 2Ring 6 hours ago
 
What is a "moon" when you really get down to it
 
12:52 PM
A celestial body made of cheese
 
Please contribute to my kickstarter which aims to launch a mircosat filled with pebbles into orbit, whereupon they will be released so that Earth can be considered to have hundreds and hundreds of moons
 
Cbg guys !
 
Not so high and mighty with your 79 moons now, are you Jupiter
Pro-Jovians will say that they'll still be leading in terms of total moon mass, but we will stick our fingers in our ears and go lalala we can't hear you
 
" To be retained by a planet, a moon must have an orbit that lies within the planet's Hill sphere".
 
i hope i won't bother anyone asking this, but what is the recommanded python package manager actually?
The docs talks about some built ins command, pyenv seems deprecated, is pipenv still good?

Or the old virtualenv and requirements are still a good way?
 
12:56 PM
I like to use pip to install packages. I don't know anything about virtual environments because I am a luddite.
 
haha
 
^^ same
 
@Bestasttung pipenv was never good
 
if you're comfortable with pip and virtualenvs, there is little reason yo search for a manager.
 
12:59 PM
yeah i must say virtualenv and pip are my favorite way, but i'm always afraid to miss some new tools which are now better
 
poetry is nice, you can give that a try
but you only get a lot out of it if you change between python projects a lot. Then again, if you don't do that already there is little need for a package manager, right?
 
Unrelated question. Posts on the main site regarding speed benchmarking often receive comments like "you can't really trust the times that a regular computer gives you, because multitasking OSes may abruptly give up CPU time to other processes". What, if anything, can the average user do to eliminate/reduce this problem?
 
ok thanks you guys !
melon sorry
 
"kill all processes other than Python's" is a futile effort on Windows because there's a million of them and they reproduce like bunnies. Does Linux fare any better?
speed.python.org apparently uses Ubuntu
 
Hey, I have an `array of object` that I don't is what size. But I want to take all the values from array and create separate arrays for them

>>> [{'id': 234, 'job': 'Testing'}, {'id': 235, 'job': 'Coding'}]
for example

I want to create a array with only ids and another with only jobs
How do I do that?
 
1:09 PM
@AbhimanyuAryan side note: that's a list, not an array
 
How about:
>>> seq = [{'id': 234, 'job': 'Testing'}, {'id': 235, 'job': 'Coding'}]
>>>
>>> keys = {key for d in seq for key in d}
>>> result = {key: [d.get(key) for d in seq] for key in keys}
>>> result
{'job': ['Testing', 'Coding'], 'id': [234, 235]}
 
@Kevin cpu time should ignore that.
 
yes @AndrasDeak list
 
Only wallclock should be affected by other processes
 
can we also all of this in one line using list Comprehensions?
 
1:11 PM
I mean, my solution is two lines, so it's at least half as good...
I guess you could do result = {key: [d.get(key) for d in seq] for key in {key for d in seq for key in d}} but that's kind of monstrous
 
@AndrasDeak This leads me to believe that all the "well there might be other processes running" commenters are just cargo-culting
 
If you believe that what is measured is CPU time then they probably are. But if you're measuring something very fast then all sorts of small overheads start to matter and your mesurement will be crap. Ideally most of what you're measuring should be what you're interested in.
I'd be more worried about caching and some unexpected IO than other processes hindering python
 
I might be naive when it comes to timing, but can't you just measure 10k times, take the min, and trust that the rule of big numbers still works?
I mean, that's what timeit does, right?
 
Concerns about IO and caching are why I expected speed.python.org to use some wacky exotic architecture like "no hard drive, no cache, we just load the entire thing into our incredibly beefy RAM" but AFAICT they have a regular old box
@Arne Certainly that would even out the occasional blip. But if you happen to have a very long-lived source of latency, then it might show up in all 10k of your tests
For example, if Windows has been downloading an 8GB patch for the last three hours
"But surely a professionally-run benchmarking team would know to eliminate all long-lived sources of latency?" you hypothetically ask. I assume that's the case. My original question is basically asking what, specifically, they're doing to accomplish this.
"Turn off Windows Update" is an excellent Step One, but beyond that it's all uncharted territory for me
 
1:24 PM
> But surely a professionally-run benchmarking team would know to eliminate all long-lived sources of latency?
[x] doubt
[ ] no doubt
 
The question remains as to whether any professionally-run teams actually exist in real life. "A ragtag crew of volunteers who are also busy with other things" might be the best we've got.
 
Maybe run a vm for benchmarks
one that s cut off from all confusing sorts of distractions like the internet, runs exactly one python process that it measures the time on and has a pre-determined amount of resources it can use to crunch the problem
call it Benchmark as a Service, make lots of money
 
The only environment I trust to be secure is a turing machine implemented in Conway's Game of Life
 
Unhelpful opinion: Y'know running the benchmarks from DOS before booting into Win3.1 to post them would eliminate some of those issues.
 
Of course I don't trust any environment to run that simulation, so I simulate Game of Life inside another Game of Life
 
1:31 PM
Hey guys, is the numpy matrix print abbreviation deterministic? I don't know how to google this and I assume it is, but I'm not sure
 
yes
 
ok awesome thanks
 
the values probably differ due to machine-precision error
~1e-16 relative error per arithmetic operation for doubles
the exact format for printing changed a few versions ago but that was one change, anything before and after that is the same for the same input
 
@kevin lists are always evaulated from left to right but in this case result = {key: [d.get(key) for d in seq] for key in keys}
we need value of key
 
2.14977509e+02 and 1.66699951e+02, machine precision error? I don't think so right?
 
1:36 PM
nope
 
then somehow tf does not load my network weights
 
anyway if you want to compare float results, use np.isclose/np.allclose
 
@AbhimanyuAryan d.get gets the value of the key.
 
yeah I know it and used it, just sanity checking
 
yup
 
1:39 PM
yaa that I got
 
If you're saying "now that I have result, how do I get a particular value out of it? For example, how do I get the list associated with id?", then you just have to index it like a regular dict.
>>> seq = [{'id': 234, 'job': 'Testing'}, {'id': 235, 'job': 'Coding'}]
>>>
>>> keys = {key for d in seq for key in d}
>>> result = {key: [d.get(key) for d in seq] for key in keys}
>>> result
{'job': ['Testing', 'Coding'], 'id': [234, 235]}
>>> result["id"]
[234, 235]
 
recbg
 
cbg
 
unfortunately not clear from that pic whether that is 2 or 3.
 
Invasive?! #triggered
 
1:43 PM
so if it is harmful I guess it must be Python 2
 
I was confused how
>>> keys = {key for d in seq for key in d} returns "id", "job", "id" & "job"

whereas
>>> keys = {key for key in d for d in seq} returns "id" and "job"
and both just works
fine
 
The second one only works if d already exists in the namespace
 
ohh yaa
@kevin
 
>>> seq = [{'id': 234, 'job': 'Testing'}, {'id': 235, 'job': 'Coding'}]
>>> keys = {key for key in d for d in seq}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'd' is not defined
>>> d = {3:4}
>>> keys = {key for key in d for d in seq}
>>> keys
{3}
 
1:45 PM
@Kevin It's pretty easy on Linux to boot into a non-multitasking CLI. Or just switch to a non-GUI terminal, traditionally done with Alt function key sequences. But I generally don't bother. I just kill my MP3 player, and if I'm serious, exit out of my browser.
 
now I'm a big confused with list comprehension evaluation. Arey evaluated from right to left or left-to-right
is their any rule?
 
left to right, same order as in a proper nested loop
# {key for d in seq for key in d}
for d in seq:
    for key in d:
        ...
 
[x for a in y for b in z] has the same evaluation order as for a in y: for b in z: result.append(x)
 
oohh thanks a lot :)
 
1:48 PM
and how do you write this thing:

[d.get(key) for d in seq] for key in keys
by expanding?
 
Not sure what you mean.
 
@PM2Ring would that actually affect multitasking behaviour? I'm a bit doubtful.
 
>>>for key in keys:
>>> for d in seq:
>>> d.get(key)
v
like this?
forgot the append call
 
{key: [d.get(key) for d in seq] for key in keys}

#is equivalent to

result_dict = {}
for key in keys:
    result_list = []
    for d in seq:
        result_list.append(d.get(key))
    result_dict[key] = result_list
 
Thanks :)
 
1:52 PM
@AndrasDeak I think it does, but I'm not 100% certain. It's been a while since I've messed around with that stuff. ;) But in that case you can just log out of your session & log into a CLI terminal.
 
Strictly speaking [d.get(key) for d in seq] for key in keys is not equivalent to anything because it isn't a valid expression by itself. Can't have a dict comprehension without the curly brackets and colon.
 
True. But if I switch to a tty the rest of the OS will be happily running along I think.
 
"I just kill my MP3 player, and if I'm serious, exit out of my browser." has the same aesthetic quality as a scene where the hot-blooded protagonist takes off his weighted training vest
"I'm impressed... You made me use 10% of my power." [unsheathes katana]
 

« first day (3096 days earlier)      last day (1853 days later) »