[EMAIL PROTECTED] wrote:
> Hi List,
>
> I have a list like this x=[7,4,2,6]
> and print x.sort()
> gives to me None ! :
>
>   
>>> x=[7,4,2,6]
>>> print x.sort()
>>>       
> None
>
> ... but
>
>   
>>> x=[7,4,2,6]
>>> x.sort()
>>> print x
>>>       
> [2, 4, 6, 7]
>
> so, why list.sort() returns None? is this normal ?
>   
No, this is not normal.
When the planets are aligned perfectly (which is very rare, thankfully), 
it creates magnetic interference that messes with Python interpreters in 
RAM and causes the list.sort method to return None.
It's still being investigated.
It just so happens that we had a momentary planet alignment earlier this 
week, which should explain the problems you've been having.

Seriously, though, see 
http://www.python.org/infogami-faq/general/why-doesn-t-list-sort-return-the-sorted-list/
 
for an explanation.
Basically, as we can see here
> (the python is "Python 2.4.3 (#69, Mar 29 2006, 17:35:34)
> [MSC v.1310 32 bit (Intel)] on win32")
>   
you're using Python 2.4, so you can just do sorted(x) and it will return 
the sorted list.

It also might be a good idea to read the rest of that FAQ.
HTH,
-Luke

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to