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

D-Man dsh8290 at rit.edu
Wed Apr 18 11:24:44 EDT 2001


On Wed, Apr 18, 2001 at 03:26:12AM -0400, Mike C. Fletcher wrote:
| 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.

Umm, I might be missing something but I think the following does that
:


def my_func( an_arg ) :
    do_something( an_arg )


If it is called with the absence of a value, an error will be raised
by the interpreter, otherwise it is passed an object (possibly None).

-D





More information about the Python-list mailing list