Neil Girdhar <mistersh...@gmail.com> added the comment:

Why can't we add an ABC into a NamedTuple instance's MRO?  Because while I like 
Eric's solution, it seems to be backwards:  tuple and list are not the special 
cases—NamedTuple is.

All sequences accept an iterable in their constructor, and NamedTuple doesn't.  
So it should be NamedTuple that is marked as being "weird".  Right now, 
NamedTuple instances claim to be tuples, but don't accept iterables to 
initialize themselves.  That seems wrong.

This problem that we have with dataclass can easily pop up somewhere else, and 
it will require the same restriction to list and tuple types to fix it 
(breaking user-defined types).

Is it imposible to add to the MRO of NamedTuple instances?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34363>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to