default arguments newbie question

Moshe Zadka moshez at zadka.site.co.il
Thu Jan 11 21:27:16 EST 2001


On Wed, 10 Jan 2001 13:37:17 -0800, Erik Max Francis <max at alcyone.com> wrote:
> Aahz Maruch wrote:
> 
> > Yup.  Technically, you really want to write "if l is None", though; if
> > you don't actually care about it being precisely None, the common
> > idiom
> > is to write "if l".
> 
> 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:

But not for user-defined objects:

class FoolErik:

	def __cmp__(self, other):
		return cmp(None, other)

-- 
Moshe Zadka <sig at zadka.site.co.il>
This is a signature anti-virus. 
Please stop the spread of signature viruses!




More information about the Python-list mailing list