| Store | Cart

Why tuple with one item is no tuple

From: Christos TZOTZIOY Georgiou <t...@sil-tec.gr>
Wed, 23 Mar 2005 02:37:21 +0200
On 15 Mar 2005 11:25:15 -0500, rumours say that roy at panix.com (Roy
Smith) might have written:

>The big question is, is it the parens that make it a tuple, or is it>the comma?  If you go along with the parens school of thought, then>(1,) is the special case.  If you believe in commas, then the () is>the special case.  In either case, it's a bit ugly, but we learn to>overlook the occasional cosmetic blemishes of those we love :-)

My take on this is that comma defines tuples, and () is the exception.

.>> tpl = 1, 2, 3 * 4; print tpl
(1, 2, 12)
.>> tpl = (1, 2, 3) * 4; print tpl
(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3)

So parentheses just change precedence (comma has lower precedence than
star).
-- 
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...

Recent Messages in this Thread
Christos TZOTZIOY Georgiou Mar 23, 2005 12:37 am
James Stroud Mar 17, 2005 12:07 am
Robert Kern Mar 17, 2005 12:45 am
James Stroud Mar 17, 2005 01:28 am
Jeremy Bowers Mar 16, 2005 09:01 pm
Kay Schluehr Mar 18, 2005 08:16 am
Steven Bethard Mar 18, 2005 03:49 pm
Antoon Pardon Mar 17, 2005 10:27 am
Diez B. Roggisch Mar 17, 2005 11:48 am
Antoon Pardon Mar 18, 2005 10:15 am
Joal Heagney Mar 27, 2005 03:58 am
Antoon Pardon Mar 29, 2005 11:20 am
Diez B. Roggisch Mar 16, 2005 04:34 pm
Daniel Dittmar Mar 16, 2005 11:00 pm
Antoon Pardon Mar 18, 2005 10:17 am
Daniel Dittmar Mar 18, 2005 11:53 am
Antoon Pardon Mar 18, 2005 12:07 pm
Messages in this thread