[Python-ideas] A subclassing API for named tuples?
Gregory P. Smith
greg at krypto.org
Sun Feb 17 00:41:06 CET 2013
On Thu, Feb 14, 2013 at 6:11 PM, Larry Hastings <larry at hastings.org> wrote:
> On 02/14/2013 05:19 AM, Nick Coghlan wrote:
>
> A recurring suggestion for collections.namedtuple is that it would be
> nice to be able to define them like this [...]
>
>
> FWIW, I think namedtuple is overused. Not that there's anything innately
> wrong with namedtuple; it's just that I think too many types are iterable
> which shouldn't be. (Nobody unpacks the stat_result anymore, that's like
> 1995 man.) I suggest people use types.SimpleNamespace unless iterability
> is specifically required.
>
Ironically the types.SimpleNamespace documentation says: "However, for a
structured record type use namedtuple() instead."
-gps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130216/c7835c8f/attachment.html>
More information about the Python-ideas
mailing list