[Python-ideas] Docstrings for namedtuple

Laurens Van Houtven _ at lvh.cc
Sun Dec 16 15:39:10 CET 2012


Err, can class bodies ever be order-sensitive? I was under the impression
names bound there work just like names bound anywhere...

Unless of course that magical decorator is secretly an AST hack, in which
case, yes, it can do whatever it wants :)


On Sun, Dec 16, 2012 at 3:06 PM, Joao S. O. Bueno <jsbueno at python.org.br>wrote:

>
>
> On 16 December 2012 11:24, Eli Bendersky <eliben at gmail.com> wrote:
>
>>
>>
>>  This may be a good time to say that personally I always disliked
>>> namedtuple's creation syntax. It is unpleasant in two respects:
>>>
>>> 1. You have to repeat the name
>>> 2. You have to specify the fields in a space-separated string
>>>
>>> I wish there was an alternative of something like:
>>>
>>> @namedtuple
>>> class Point:
>>>   x = 0
>>>   y = 0
>>>
>>>
>> And to the point of Serhiy's original topic, with this syntax there would
>> be no need to invent yet another non-standard way to specify things like
>> docstrings.
>>
>
> While we are at it,
> why nto simply:
>
> class Point(namedtuple):
>    x = 0
>    y = 0
>
> ?
>
>>
>> Eli
>>
>>
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> http://mail.python.org/mailman/listinfo/python-ideas
>>
>>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
>


-- 
cheers
lvh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121216/fc3ec9f1/attachment.html>


More information about the Python-ideas mailing list