On 28-aug-2006, at 16:21, Edward C. Jones wrote:

>
> 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?

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

This works in python 2.4 as well.

Ronald

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to