[Tutor] Why does print(a_list.sort()) return None?

boB Stepp robertvstepp at gmail.com
Sun Mar 29 08:24:43 CEST 2015


On Sun, Mar 29, 2015 at 1:00 AM, Cameron Simpson <cs at zip.com.au> wrote:

> The former print:
>
>  print(a_list.sort())
>
> is printing the result of "a_list.sort()".
>
> Like most Python functions that operate on something (i.e. .sort, which
> sorts the list in place), the .sort method returns None. And that is
> printed.

Ah! I did not realize this. That makes sense now. Many thanks, Cameron!

boB


More information about the Tutor mailing list