Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

Here's the status of the various ways to do it:

1) In 3.7, collections.namedtuple() added the *defaults* parameter and the 
*_field_defaults* attribute.

2) In 3.6.1, typing.NamedTuple added support for default values.

3) In older versions of Python, it was always possible to directly attach 
default values:

    >>> from collections import namedtuple
    >>> Point = namedtuple('Point', ('x', 'y'))
    >>> Point.__new__.__defaults__ = (10, )
    >>> Point(5)
    Point(x=5, y=10)

Given that we can't introduce new features to old versions of Python, it looks 
like this can be closed as "out-of-date".

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38996>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to