copysort patch, was RE: [Python-Dev] inline sort option
Skip Montanaro
skip at pobox.com
Sat Oct 18 11:16:00 EDT 2003
More information about the Python-Dev mailing list
Sat Oct 18 11:16:00 EDT 2003
- Previous message: copysort patch, was RE: [Python-Dev] inline sort option
- Next message: copysort patch, was RE: [Python-Dev] inline sort option
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: copysort patch, was RE: [Python-Dev] inline sort option
- Next message: copysort patch, was RE: [Python-Dev] inline sort option
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list