Hmm... An idea: if a,b==c,d:
Brad Hards
bhards at bigpond.net.au
Mon Nov 18 17:00:31 EST 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tue, 19 Nov 2002 08:49, Richard Dillingham wrote:
> Kind of like we have multiple assignments in a line (oldx,oldy=x,y), what
> do you think of the ability to have multiple tests in an if statement with
> only one == or >=.
I think of (oldx, oldy = x,y) as forming a tuple (x,y), and then unpacking it
to oldx and oldy.
> This would mean that lines like the following:
> if posx>=coords[0] and posy>=coords[1] and posx<=coords[2] and
> posy<=coords[3]:
>
> Could be rewritten like so:
> if posx,posy>=coords[0],coords[1] and posx,posy<=coords[2],coords[3]
I am not sure what it means for a tuple (posx,posy) to be greater than a
another tuple (coords[0], coords[1]).
What is the result of (posx, posy >= coords[0], coords[1]) for the following
cases:
For posx> coords[0] and posy>coords[1]? (I assume that this is true)
For posx< coords[0] and posy<coords[1]? (I assume that this is false)
For posx> coords[0] and posy<coords[1]? (Not sure about this)
For posx< coords[0] and posy<coords[1]? (Not sure about this)
I think that X > Y implies Y<X. I'm not clear on how this would work for a
tuple comparison.
Brad
- --
http://linux.conf.au. 22-25Jan2003. Perth, Aust. I'm registered. Are you?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE92WL/W6pHgIdAuOMRAsbwAKCPfcskMywZoS4FmBc67w2TUwI1FACgvhUD
n2N6cLZFl0VxKgPj+QgMCSw=
=ZR3+
-----END PGP SIGNATURE-----
More information about the Python-list
mailing list