Hmm... An idea: if a,b==c,d:
Richard Dillingham
shadowlord13_1 at yahoo.com
Mon Nov 18 18:26:04 EST 2002
> Not really... ()s don't have anything particularly to do with
> tuples. The comma is the tupple constructor operator: a,c is a
> tuple (a,c) is the same tuple with parens around it.
Hm.
Perhaps from __future__ import combinedcomparisons
Also, if a,b==c,d doesn't work, I get an error:
if a,b==c,d: print a
^
SyntaxError: invalid syntax
The ^ is under the comma.
So it's not assuming those are tuples, it's saying "WTH are you using a
comma in an if statement for? Stop that! That tickles!"
Whereas if (a,b)==(c,d): print a
DOES work.
So again, for if-statements, this looks like it could be done, unless the
CVS version makes it recognize ,s in if statements as being for tuples.
More information about the Python-list
mailing list