Idiom gone, or did it really ever exist? () is ()

Mike C. Fletcher mcfletch at home.com
Wed Apr 18 03:26:12 EDT 2001


You want this kind of construct when creating "generic services" that can
process any object type (including None), so need to be able to determine
whether the object passed is, in fact, the value None, or merely the absence
of a value.

Anyway, not a huge issue one way or another.  Enjoy,
Mike

-----Original Message-----
From: Steve Purcell [mailto:stephen_purcell at yahoo.com]
Sent: Wednesday, April 18, 2001 03:03
To: Delaney, Timothy
Cc: Python List (E-mail)
Subject: Re: Idiom gone, or did it really ever exist? () is ()


Delaney, Timothy wrote:
...
Agreed. I'm just saying that this *is* the convention, not that replacing
the magic tuple values with None will work without further changes.

Given

   def foo(bar=None):
      ...

I think it's reasonable that

   foo()

and

   foo(None)

do the same thing.

Why prevent people from explicitly calling your function in the default way?
...





More information about the Python-list mailing list