On 3/24/14, 5:44 AM, bearophile wrote:
w0rp:

I am a regular Python user, and I advise against using this syntax for
tuples. I have been bitten many times by something which I thought was
a tuple becoming an expression and something I thought was a simple
expression becoming a tuple.

I agree, 1-tuples in Python are tricky. Compare it with the clear Python
list literal syntax:

[]        => 0-length list
[1]       => 1-length list
[1, 2]    => 2-length list
[1, 2, 3] => 2-length list

Unfortunately ASCII offers a limited choice of delimiters :-)


I don't have an alternative syntax to propose.

Look at some of the syntaxes here:
http://wiki.dlang.org/DIP32#Use_case_of_uniform_tuple_syntax

One of the syntaxes:

@{}
@{a}
@{a, b}
@{a, b, c}

WTF???

tuple()
tuple(a)
tuple(a, b)
tuple(a, b, c)


Andrei

Reply via email to