[Tutor] Re: Re: Re: list method sort()
Andrei
project5 at redrival.net
Fri Apr 2 16:10:10 EST 2004
Tim Peters wrote on Fri, 2 Apr 2004 15:28:23 -0500:
> [Andrei]
>> Well, yes, you can argue that *all* operations which modify in-place
>> should return the modified object as well - I don't know if this
>> would be better or not: ...
>
> Life would be hell in interactive Python shells if these things *didn't*
> return None:
>
>>>> somelist.sort()
>
> Oops! Nobody wants to sit and wait for an arbitrary amount of output then.
Very good point there; I should have thought of it, as I've written a
little calculator-type application in Python which works similarly to the
Python shell, but only evaluates expressions. I had to add special syntax
and code in order to avoid exactly this kind of output.
<snip>
> Against my better judgment, Python 2.4 is adding a sorted() function to the
> builtins, to stop people whining about this particular case. That's against
Oh, I didn't know. I don't mind it, but I'm not very fond of the name as to
me it sounds like it's supposed to return a boolean indicating whether that
particular list is sorted or not.
--
Yours,
Andrei
=====
Real contact info (decode with rot13):
cebwrpg5 at jnanqbb.ay. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq
gur yvfg, fb gurer'f ab arrq gb PP.
More information about the Tutor
mailing list