Interesting list Validity (True/False)

Carsten Haese carsten at uniqsys.com
Sun May 13 09:57:26 EDT 2007


On Sat, 2007-05-12 at 18:43 -0700, mensanator at aol.com wrote:
> > That doesn't explain what you mean. How does "if arg==True" test whether
> > "a list is a boolean"?
> 
> >>> type(sys.argv)
> <type 'list'>
> >>> type(True)
> <type 'bool'>

All right, so what you meant was "Assuming that arg is a list, 'if
arg==True' will always fail because lists never compare equal to any
boolean."

> Actually, it's this statement that's non-sensical.
> 
> <quote>
> "if arg==True" tests whether the object known as arg is equal to the
> object known as True.
> </quote>
>
> [snip examples of "surprising" equality tests...]

The statement I made is simply the meaning of "if arg==True" by
definition, so I don't see how it can be nonsensical.

The problem is that you consider equality tests in Python to be
nonsensical because they don't fit with your opinion of what equality
should mean.

Regards,

-- 
Carsten Haese
http://informixdb.sourceforge.net





More information about the Python-list mailing list