Re: Interesting list Validity (True/False)
- From: "mensanator@xxxxxxx" <mensanator@xxxxxxx>
- Date: 12 May 2007 18:43:54 -0700
On May 12, 8:10?pm, Carsten Haese <cars...@xxxxxxxxxxx> wrote:
On Sat, 2007-05-12 at 17:55 -0700, mensana...@xxxxxxx wrote:
On May 12, 12:56?pm, Carsten Haese <cars...@xxxxxxxxxxx> wrote:
On Fri, 2007-05-11 at 14:26 -0700, mensana...@xxxxxxx 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 'list'>type(sys.argv)
<type 'bool'>type(True)
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.
<type 'int'>a = 1
b = (1,)
c = [1]
d = gmpy.mpz(1)
type(a)
<type 'tuple'>type(b)
<type 'list'>type(c)
<type 'mpz'>type(d)
Falsea==b
Falseb==c
Truea==d
And yet a==d returns True. So why doesn't b==c
also return True, they both have a 1 at index position 0?
Truex = [1]
y = [1]
x==y
--
Carsten Haesehttp://informixdb.sourceforge.net
.
- Follow-Ups:
- Re: Interesting list Validity (True/False)
- From: Carsten Haese
- Re: Interesting list Validity (True/False)
- From: Steven D'Aprano
- Re: Interesting list Validity (True/False)
- References:
- Interesting list Validity (True/False)
- From: nufuhsus
- Re: Interesting list Validity (True/False)
- From: mensanator@xxxxxxx
- Re: Interesting list Validity (True/False)
- From: nufuhsus
- Re: Interesting list Validity (True/False)
- From: mensanator@xxxxxxx
- Re: Interesting list Validity (True/False)
- From: Carsten Haese
- Re: Interesting list Validity (True/False)
- From: mensanator@xxxxxxx
- Re: Interesting list Validity (True/False)
- From: Carsten Haese
- Interesting list Validity (True/False)
- Prev by Date: Problems with thread safety
- Next by Date: Re: How to cleanly pause/stop a long running function?
- Previous by thread: Re: Interesting list Validity (True/False)
- Next by thread: Re: Interesting list Validity (True/False)
- Index(es):
Relevant Pages
|