[Python-Dev] I'd like list.pop to accept an optional second

Fred L. Drake Fred L. Drake, Jr." <fdrake@acm.org
1999年7月23日 12:30:17 -0400 (EDT)


Skip Montanaro writes:
 > Why not go all the way to Perl with
 > 
 > top = list.pop() unless IndexError
 Trying to kill me, Skip? ;-)
 Actually, the semantics are different. If we interpret that using
the Perl semantics for "unless", don't we have the same thing as:
	if not IndexError:
	 top = list.pop()
 Since IndexError will normally be a non-empty string or a class,
this is pretty much:
	if 0:
	 top = list.pop()
which certainly isn't quite as interesting. ;-)
 -Fred
--
Fred L. Drake, Jr.	 <fdrake@acm.org>
Corporation for National Research Initiatives

AltStyle によって変換されたページ (->オリジナル) /