[Python-Dev] I'd like list.pop to accept an optional second
Skip Montanaro
skip@mojam.com (Skip Montanaro)
Fri, 23 Jul 1999 15:23:12 -0500 (CDT)
Fred> Skip Montanaro writes:
>> Why not go all the way to Perl with
>>
>> top = list.pop() unless IndexError
Fred> Trying to kill me, Skip? ;-)
Nope, just a flesh wound. I'll wait for the resulting infection to really
do you in. ;-)
Fred> Actually, the semantics are different. If we interpret that using
Fred> the Perl semantics for "unless", don't we have the same thing as:
Yes, but the flavor is the same. Reading Perl code that uses the unless
keyword always seemed counterintuitive to me. Something like
x = y unless foo;
always reads to me like, "Assign y to x. No, wait a minute. I forgot
something. Only do that if foo isn't true." What was so bad about
if (!foo) { x = y; }
That was my initial reaction to the use of the trailing except.
We argue a lot in the Python community about whether or not a proposed
language feature increases the expressive power of the language or not
(which is a good idea in my opinion). The Perl community has apparently
never been afflicted with that disease.
smiles all 'round...
Skip