Raymond Hettinger added the comment:
[R David Murray]
> So I vote -0.5.
Put me down for a full -1:
* This would be a potentially confusing addition to the API.
* It may also encourage bad practices that we don't want to see in real code.
* We want to be able to search for the namedtuple definition, want to have a
meaningful repr, and want pickling to be easy.
* This doesn't have to be shoe-horned into the namedtuple API. If an actual
need did arise, it is trivial to write a wrapper that specifies whatever
auto-naming logic happens to make sense for a particular application:
>>> from collections import namedtuple
>>> def auto_namedtuple(*attrnames, **kwargs):
typename = '_'.join(attrnames)
return namedtuple(typename, attrnames, **kwargs)
>>> NT = auto_namedtuple('name', 'rank', 'serial')
>>> print(NT.__doc__)
name_rank_serial(name, rank, serial)
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue31085>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com