2 ms·
Happened to me too, I always used 'for key in mydict: do_something(key, mydict[key])' instead of 'for key, value' I guess python leaves so many ways to do thin
by DeepDuh 14y ago
Happened to me too, I always used 'for key in mydict: do_something(key, mydict[key])' instead of 'for key, value'
I guess python leaves so many ways to do things that you tend to settle on some style quickly even if it's not the most efficient one.
When self learning new languages I still miss an efficient way to get all the idioms. However I think that in python it's not really that important, as long as you get stuff done - your code is still going to be quite readable.
- RyanMcGreal 14y agoPython doesn't always hew too closely to TSBOAPOOOWTDI, despite Ken Peters' lovely entreaty. http://www.python.org/dev/peps/pep-0020/ http://www.python.org/dev/peps/pep-0020/