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

Fred L. Drake Fred L. Drake, Jr." <fdrake@acm.org
Fri, 23 Jul 1999 11:07:37 -0400 (EDT)


Tim Peters wrote:
 > As a function (builtin or not), tryexcept will never get called if
 > list.pop() raises an exception.

M.-A. Lemburg writes:
 > Oh well, forget the whole idea then. list.pop() is really not

  Giving up already?  Wouldn't you just love this as an expression
operator (which could work)?
  How about:

      top = list.pop() excepting IndexError, default

  Hehehe... ;-)


  -Fred

--
Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives