[Python-ideas] Docstrings for namedtuple

M.-A. Lemburg mal at egenix.com
Wed Dec 12 21:19:19 CET 2012


On 12.12.2012 21:12, Serhiy Storchaka wrote:
> On 12.12.12 21:56, M.-A. Lemburg wrote:
>> IMO, attributes should be documented in the existing doc parameter,
>> not separately. This makes the intention clear and the code overall
>> more readable.
> 
> Sorry, I didn't understand what you mean. There is no doc parameter for namedtuple yet.

Ah, sorry. Please scratch the "existing" in my reply :-)

+1 on a doc parameter on namedtuple() - property() already has such
   a parameter, which is probably why I got confused.

-0 on having separate doc strings for the fields. Their meaning will
   usually be clear from the main doc string.

> For overloading class docstring we can use inheritance idiom. But there is no way to change field
> docstring. All field docstrings generated using template 'Alias for field number {index:d}'.

Yes, I've seen that:
http://docs.python.org/2/library/collections.html?highlight=namedtuple#collections.namedtuple

It may not be too helpful, but it's an accurate description of the
field's purpose :-)

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Dec 12 2012)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2012-12-05: Released eGenix pyOpenSSL 0.13 ...    http://egenix.com/go37
2012-11-28: Released eGenix mx Base 3.2.5 ...     http://egenix.com/go36
2013-01-22: Python Meeting Duesseldorf ...                 41 days to go

::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/



More information about the Python-ideas mailing list