[Python-ideas] __missing__ object/keyword
Leif Walsh
leif.walsh at gmail.com
Sun Nov 9 00:21:59 CET 2008
On Sat, Nov 8, 2008 at 5:06 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Python already has the machinery to make this work. All
> that's needed is a way to leave parameters unbound, and
> a syntax for asking "Would I get a NameError if I were to
> refer to this name now?"
Well, there's always
def Foo(*args, **kwargs):
try:
x = kwargs['x']
except KeyError, unused_e:
x = default_x
--
Cheers,
Leif
More information about the Python-ideas
mailing list