copysort patch, was RE: [Python-Dev] inline sort option
Skip Montanaro
skip at pobox.com
Sat Oct 18 11:16:00 EDT 2003
Guido> For one, this will surely make lots of people write
Guido> for key in D.keys().copysort():
Guido> ...
Guido> which makes an unnecessary copy of the keys.
It might be viewed as unnecessary if you intend to change D's keys within
the loop.
Guido> keys = D.keys()
Guido> keys.sort()
Guido> for key in keys:
Guido> ...
Current standard practice is also fine.
Skip
More information about the Python-Dev
mailing list