On Monday, 24 March 2014 at 12:44:22 UTC, 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}
Bye,
bearophile
Do you know what Rust does in the case of 1-tuples?