What behavior would you expect?

Dan Sommers dan at tombstonezero.net
Fri Feb 20 00:58:09 EST 2015


On Thu, 19 Feb 2015 22:51:57 -0700, Jason Friedman wrote:

>>
>> I'd still advise using my_list.sort() rather than sorted(), as you
>> don't need to retain the original.
>>
>>
> Hmm.
> 
> Trying to figure out what that looks like.
> If I understand correctly, list.sort() returns None.
> What would I return to the caller?

my_list.  In the end, it'll look something like this:

def f():
    my_list = some_other_function_that_returns_an_unsorted_list()
    my_list.sort()
    return my_list



More information about the Python-list mailing list