Hmm... An idea: if a,b==c,d:
Erik Max Francis
max at alcyone.com
Mon Nov 18 20:02:54 EST 2002
Richard Dillingham wrote:
>
> if a,b>c,d: print a
> File "<input>", line 1
> if a,b>c,d: print a
> ^
> SyntaxError: invalid syntax
But now consider:
t = a, b > c, d
This _is_ legal, and refers to a 3-tuple. It's legal in an if clause,
although the parentheses are required. What you want is an exception so
that the _same exact code_ will have different meanings in different
contexts (in one case it creates a 3-tuple, in the other it does a
pairwise comparison of two n-tuples). This is an extremely bad idea.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ All the people in his neighborhood turn around and get mad and sing
\__/ Public Enemy
Erik Max Francis' bookmarks / http://www.alcyone.com/max/links/
A highly categorized list of Web links.
More information about the Python-list
mailing list