Tuple Format?
Grant Edwards
nobody at nowhere.nohow
Sat Sep 2 22:56:49 EDT 2000
In article <03092000.2 at sanctum.local.jae.ddns.org>, Jürgen A. Erhard wrote:
>People don't have a problem because they don't use it... at least *I* don't.
>I didn't even know it's there...
>
>Or I don't have to (what use is an empty tuple?)
dunno.
>A one-element tuple is something you *have* to deal with (at least for
>the apply(...) case, I think).
>PS: I had just learned that "parens don't build tuples, commas build
>tuples", then you folks come along and get me back to square one. The
>tuple syntax is a bigger crock than I thought.
It's not that bad unless you think about it too much.
I suspect that most people always use parens around tuples (and probably
think they have to unless you actually pin them down and make them think
about it).
That means that in practice, tuples look like:
empty: ()
singleton: (x,)
general: (x,y,z)
Noticed that if you always use parens, all you have to remember is to throw
a comma in at the end of a singleton. It's a rule that works, but it's
fuzzing over the actual syntax a bit.
--
Grant Edwards grante Yow! LOOK!! Sullen
at American teens wearing
visi.com MADRAS shorts and "Flock of
Seagulls" HAIRCUTS!
More information about the Python-list
mailing list