[Python-Dev] Function arguments

Fred L. Drake, Jr. fdrake@acm.org
Thu, 18 Oct 2001 08:00:00 -0400


Thomas Heller writes:
 > I was thinking of a popitem() dictionary method taking
 > (optionally) 2 arguments: the name of the item to pop,
 > and the default value to return if the item is not present

  A one-arg version of the {}.popitem() method was discussed
extensively, but some people did not think it sufficiently useful to
include that variation.  (I don't think anyone suggested a 2-arg
version at the time.)
  This certainly leads me to think the decision not to support a
one-arg version should be considered, or maybe a two-arg version.
However, I do expect the usage with args and without args are
substantially different.  Perhaps there should be a different method
that has the one- and two-arg versions you describe, but does not
support the 0-arg semantics of the current popitem()?  The catch is
that I'd name this popitem() as well.  ;-)
  Anyone else?


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation