[Python-Dev] namedtuple implementation grumble
Raymond Hettinger
raymond.hettinger at gmail.com
Mon Jun 9 02:03:11 CEST 2014
More information about the Python-Dev mailing list
Mon Jun 9 02:03:11 CEST 2014
- Previous message: [Python-Dev] namedtuple implementation grumble
- Next message: [Python-Dev] namedtuple implementation grumble
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Jun 7, 2014, at 6:25 AM, R. David Murray <rdmurray at bitdance.com> wrote: >> I guess I could duck-type it based on the _fields attribute but that >> feels implicit and fragile. >> >> What do you guys suggest? > > I seem to remember a previous discussion that concluded that duck typing > based on _fields was the way to go. (It's a public API, despite the _, > due to name-tuple's attribute namespacing issues.) Yes. That is the recommended approach. IIRC that was Guido's suggestion rather than creating an abstract base class for a named tuple (any tuple-like class with indexable elements that are also accessible using named attributes). Raymond -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20140608/e15decd5/attachment.html>
- Previous message: [Python-Dev] namedtuple implementation grumble
- Next message: [Python-Dev] namedtuple implementation grumble
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list