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

Remco Gerlich scarblac at pino.selwerd.nl
Wed Apr 18 20:23:02 EDT 2001


D-Man <dsh8290 at rit.edu> wrote in comp.lang.python:
> 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).

His function should also work when no argument was given. Except it should
do something special then.

-- 
Remco Gerlich



More information about the Python-list mailing list