[Python-ideas] anonymous object support
dag.odenhall at gmail.com
dag.odenhall at gmail.com
Sat Aug 6 23:15:06 CEST 2011
> If NamedTuple were documented as having a custom metaclass, and if this were
> a common idiom, that would not be too confusing as all.
Or make the presence of a metaclass explicit, i.e. have NamedTuple be
the metaclass.
Working example in case anyone was curious how this is done:
http://paste.pocoo.org/show/453814/
I think this might be acceptable in such edge cases as named tuples
and enums, if the metaclass isn't hidden away in a base class. Might
be difficult to explain to a beginner, but on the other hand they
might find it easier to *read*.
More information about the Python-ideas
mailing list