Tuple Semantics - Rationale'?
Steven D. Majewski
sdm7g at Virginia.EDU
Wed Jul 11 15:58:41 EDT 2001
Singleton tuple syntax is an odd cosmetic wart of Python,
caused by using the same delimiters "( )" for both
expression grouping and tuple literals. You don't have
the same problem with singleton lists because
[1], [1+3] and 2*[1+3] are all unambiguous.
Without the singleton comma rule:
(1), (1+3), and 2*(1+3)
all would have two possible interpretations:
1, 4, 8
(1) (4) (4,4)
So the comma is required to distinguish them.
Problem is, there just aren't enough delimiters in Ascii!
-- Steve Majewski
More information about the Python-list
mailing list