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.
56
u/captain_cashew May 30 '19
My company is moving from 2.6 to 2.7! Yay!