Why tuple with one item is no tuple
Robert Kern
rkern at ucsd.edu
Wed Mar 16 19:45:58 EST 2005
James Stroud wrote:
> On Wednesday 16 March 2005 07:22 am, Diez B. Roggisch wrote:
>
>>As I said: show me which parentheses to use
>
>
> I kind of like the comma as a tuple "parentheses"
>
> ,1,2,3,
>
> replacing
>
> (1,2,3)
> or
> 1,2,3,
> or
> 1,2,3
> or (isn't this is getting out of hand?)
> (1,2,3,)
>
> Why not--except of course for backward compatability? Comma is not used for
> anything else in python as far as I know.
[1, 2, 3]
{'a': 0, 'b': 2}
f(x, y)
print foo,
> This would be very unambiguous.
Not entirely.
> Then, the purity would manifest itself the naked comma being an empty tuple.
> Think about the zen of:
>
> ,
Is that a tuple or grit on my monitor? :-)
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list