What behavior would you expect?
Dave Angel
davea at davea.name
Fri Feb 20 08:07:29 EST 2015
On 02/20/2015 12:51 AM, 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?
>
return_list = ....
return_list.sort(key=..., reverse = True)
return return_list
>
> Oops, guess I'm not really returning a list, I'm returning an iterator.
Now you'll be returning a list, I believe.
--
DaveA
More information about the Python-list
mailing list