On May 12, 8:10?pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Sat, 2007-05-12 at 17:55 -0700, [EMAIL PROTECTED] wrote: > > On May 12, 12:56?pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > > > On Fri, 2007-05-11 at 14:26 -0700, [EMAIL PROTECTED] wrote: > > > > if arg==True: > > > > > tests the type property (whether a list is a boolean). > > > > That sounds nonsensical and incorrect. Please explain what you mean. > > > <quote> > > Sec 2.2.3: > > Objects of different types, except different numeric types and > > different string types, never compare equal; > > </quote> > > 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'> 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> None of these four examples are "equal" to any other. >>> a = 1 >>> b = (1,) >>> c = [1] >>> d = gmpy.mpz(1) >>> >>> type(a) <type 'int'> >>> type(b) <type 'tuple'> >>> type(c) <type 'list'> >>> type(d) <type 'mpz'> >>> a==b False >>> b==c False >>> a==d True And yet a==d returns True. So why doesn't b==c also return True, they both have a 1 at index position 0? >>> x = [1] >>> y = [1] >>> x==y True > > -- > Carsten Haesehttp://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list