Tuple Format?

Grant Edwards nobody at nowhere.nohow
Sun Sep 3 20:36:20 CEST 2000

In article <39B27F86.7B023B2D at alcyone.com>, Erik Max Francis wrote:
>Grant Edwards wrote:
>> Single quotes would not be string delimiters any more.  Strings would all
>> be double-quoted. That means we'd loose the convenience of being able to
>> type things like 'he said "this is a string."' and would have to fall back
>> to escaping quotes inside strings: "he said \"this is a string\".".
>Why are you suggesting such a fundamental change in the language for
>such a strange change?  You're basically reworking the entire way tuples
>and string literals work -- for what purpose?

1) The tuple syntax in Python is irregular.  We're discussing ways to make
   it more regular.

2) Such changes will never get implimented (for reasons I've already
   explained), so relax, it's all moot.

>It has other problems.  What is
>    ''a''?

That's illegal sytax.  You've got four tuple-end-delimiters and no

>Is it the tuple ((a))?

No, that's just plain _a_ (both in current syntax and my theoretical,
new-and-improved syntax).

Perhaps you mean ((a,),)?  [see why we're discussing this?]

If so, then that would be ``a''

>Or is it an empty tuple, an a and another empty tuple: () a ()?

That would be  `'a`'

>> I don't think the single back-quote "`" is used for anything in Python, is
>> it?
>Sure it is.
>    print `1`

Yea, I forgot about that.  

But, _if_ we didn't use the single-quote for strings, and _if_ we didn't use
the single-back-quote for repr(), then we could have a pair of delimeters to
use for tuples: no more trying to explain that commas are tuple-construction
operators that are sometimes infix-binary and sometimes postfix-unary,
except for empty tuples where they aren't used at all because empty tuples
are constructed using parens and no commas.

Parens would only be overloaded for two different things, and it would be
unambiguious whether commas were part of statement syntax or list/tuple/dict
item seperators.

Grant Edwards                   grante             Yow!  I guess it was all a
                                  at               DREAM... or an episode of
                               visi.com            HAWAII FIVE-O...

More information about the Python-list mailing list