[Python-3000] Warning about future-unsafe usage patterns in Python 2.x e.g. dict.keys().sort() (original) (raw)

Fred L. Drake, Jr. fdrake at acm.org
Mon Aug 28 16:45:23 CEST 2006


On Monday 28 August 2006 10:21, Edward C. Jones wrote:

d = dict() ... thekeys = d.keys() thekeys.sort() for key in thekeys: ...

What should I use in Python 3.0?

d = dict() ... for key in sorted(d.keys()): ...

-Fred

-- Fred L. Drake, Jr.



More information about the Python-3000 mailing list