[Tutor] Why does print(a_list.sort()) return None?
boB Stepp
robertvstepp at gmail.com
Sun Mar 29 07:34:09 CEST 2015
I am puzzled by the following:
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600
64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> a_list = [5, 0, 2, 4, 1]
>>> print(a_list.sort())
None
>>> print(a_list)
[0, 1, 2, 4, 5]
>>>
I expected the first print statement to return what the second one
did. Apparently the first print printed a_list, then did the sort. Why
is this so?
--
boB
More information about the Tutor
mailing list