Hmm... An idea: if a,b==c,d:
Jan D. Wegner
Jan.Wegner at zuken.de
Tue Nov 19 07:46:47 EST 2002
Hi,
using py 2.2.2 on winNT
l = (1, 2, 3, 4)
ans = l in [l] # is tuple l in list l ?
ans
1 # allways true
ans < 2
1 # its a boolean, though ...
am I right?
( or is ther a chance to execute 'if l in ( [l] < 2 ):' )
/j
Michael Hudson schrieb:
> Alex Martelli <aleax at aleax.it> writes:
>
>
>>Richard Dillingham wrote:
>>
>>
>>>>It's better written as:
>>>>
>>>>if coords[0]<=posx<=coords[2] and coords[1]<=posy<=coords[3]:
>>>
>>>Hmm.... I just tried that, and am quite amazed to find that it actually
>>>works.
>>
>>Python comparison operators CHAIN -- a wonderful little trait...
>
>
> Indeed they do. There's a wonderful little wart, though. What does
> this:
>
> if 1 in [1] < 2:
> print 1
> else:
> print 2
>
> print?
>
> Cheers,
> M.
> (actually, the answer may be Python version dependent...)
>
--
Jan Wegner Software Engineer Zuken GmbH
Vattmannstrasse 3 D-33100 Paderborn
Tel: +49 5251 150627 Fax: +49 5251 150700
----*... and may all your GUIs be fast and friendly.*----
More information about the Python-list
mailing list