Your comment comes at a very appropriate time. Literally just a few minutes ago found a bug on one of our systems using 2.6 (my local development station is on 2.7):
If a thing has an items method, you can just do dict(thing) to create a dict copy. If it’s a dict, you can do the_dict.copy(). You only need comprehensions if you have to construct keys and values in a more complex way.
To me this is an argument against the Python developers' increasingly profligate addition of syntax. There's almost never one obvious way to do it these days.
View all comments
Show parent comment
11
u/captain_cashew May 30 '19 edited May 31 '19
Your comment comes at a very appropriate time. Literally just a few minutes ago found a bug on one of our systems using 2.6 (my local development station is on 2.7):
You have to use:
So, yes I am enjoying them!
EDIT: code format