This is the kernel of a really useful idea, IMO. In fact, I already proposed something related to this-- unification of dict-making APIs-- back in May: 

But I like the Struct ABC approach you've suggested, too. 


"I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler

On Wed, Oct 16, 2019 at 1:30 PM Steve Jorgensen <> wrote:
I feel like this proposal is not quite right, but maybe the idea will provoke some thoughts about something similar that -would- be right.

The idea first came to me upon realizing that since `namedtuple` classes have no special base class beyond `tuple`, there should be some way of identifying them as being primarily structural, even though they are instances of `tuple` which, in other cases, usually means something that is primarily sequential.

It is easily possible to identify a namedtuple by checking to see whether it has an `_asdict` method, but it might be nice to formalize the way that struct-like objects are identified in a virtual base class and be something that had application beyond just checking whether a `tuple` is a `namedtuple`.
Python-ideas mailing list --
To unsubscribe send an email to
Message archived at
Code of Conduct: