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

Edward C. Jones edcjones at comcast.net
Mon Aug 28 16:21:10 CEST 2006


Brian Quinlan said:

It is my understanding that, in Python 3000, certain functions and methods that currently return lists will return some sort of view type (e.g. dict.values()) or an iterator (e.g. zip). So certain usage patterns will no longer be supported e.g. d.keys().sort().

I use this idiom fairly often:

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

What should I use in Python 3.0?



More information about the Python-3000 mailing list