NoneType object not iterable

Paul Rubin http
Fri Jul 13 20:28:07 CEST 2007

Stargaming <stargaming at> writes:
> It does not turn into something. The `sort()` method just works "in
> place", i. e. it will mutate the list it has been called with. It
> returns None (because there is no other sensible return value).
> For you, that means: You don't have to distinguish between keyList and
> sortedList. Just call ``.sort()`` on keyList and it will just work.

Alternatively, use
   sortedList = sorted(keyList)

More information about the Python-list mailing list