[Python-ideas] One-element tuple

Gregory P. Smith greg at krypto.org
Fri Mar 14 21:46:43 CET 2008


-1 on deprecating the syntax.  the tuple(['hello']) syntax is much much
slower, a factor of 20x here.  trailing ,s when you only have one item are
how python tuple syntax is defined allowing them to use ()s instead of
needing other tokens.

gps

On 3/12/08, Leszek Dubiel <Leszek.Dubiel at dubielvitrum.pl> wrote:
>
>
>
> I would suggest to deprecate one-element tuple construction with colon at
> the end, because this looks ugly, is not self-evident for other people
> reading code, looks like some type of trickery.
>
> It would prefer tutorial (
> http://docs.python.org/dev/3.0/tutorial/datastructures.html#tuples-and-sequences)
> to use instead of
>
>  >>> ('hello',)
> ('hello',)
>
>
>
> this syntax:
>
>  >>> tuple(['hello'])
> ('hello',)
>
> .
>
>
>
> PS.
>
> Funcitons set(), tuple(), list() and dict() are good!
>
> Syntax
>
>     myset = {'a', 'b'}
>
> is absolutely perfect too!
>
>
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20080314/7bdec3d8/attachment.html>


More information about the Python-ideas mailing list