default arguments newbie question

Mike Fletcher mfletch at tpresence.com
Wed Jan 10 18:20:57 EST 2001


To expand on that "fundamental types" qualification...

class NULL:
    def __cmp__( self, other ):
        if other:
           return -1
        else:
           return 0

Will break the assumption that x == None means x is None.  That is, NULLs
will equate to any "false" value, including None, but would not match with
an "is" test.  Not really important for the original questioner, but oh well
:o) , digressions are part of Pythonic culture.

Enjoy,
Mike



-----Original Message-----
From: Erik Max Francis
To: python-list at python.org
Sent: 1/10/2001 4:37 PM
Subject: Re: default arguments newbie question

Aahz Maruch wrote:
...
Eh?  I don't see that.  Any value which is not None will compare unequal
to None, correct?  Certainly this true for the fundamental types like
strings, numbers, tuples, and lists:
...




More information about the Python-list mailing list