[Python-ideas] A subclassing API for named tuples?
Antoine Pitrou
solipsis at pitrou.net
Thu Feb 14 16:42:53 CET 2013
Le Thu, 14 Feb 2013 08:32:49 -0700,
Eric Snow <ericsnowcurrently at gmail.com> a
écrit :
>
> Something similar that I've been using:
>
> @as_namedtuple("a b c d e")
> class MyTuple:
> """My namedtuple with extra stuff."""
> @property
> def something_special(self):
> """..."""
> return ...
>
> Support for default values is also something I've added, but that's
> relatively orthogonal to this discussion.
Ah, right. That's also why I often need to subclass namedtuple.
Regards
Antoine.
More information about the Python-ideas
mailing list