[BangPypers] sort query

Noufal Ibrahim noufal at gmail.com
Sat Oct 24 10:42:17 CEST 2009


On Sat, Oct 24, 2009 at 1:32 PM, bhaskar jain
<bhaskar.jain2002 at gmail.com> wrote:
> Hello,
>
>  Can sort not modify read-only location.
>
>>>> d
> {'a': 1, 'c': 3, 'b': 2}
>
>>>> id(d)
> 412816
>
>>>> id(d.keys())
> 404296
>
>>>> type(d.keys())
> <type 'list'>
>
>>>> print d.keys().sort()

The sort method of a list doesn't return a sorted list. As for the
question of what exactly did that sort and where is the sorted list,
I'm not sure.


-- 
~noufal
http://nibrahim.net.in


More information about the BangPypers mailing list