This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author NeilGirdhar
Recipients NeilGirdhar, alexdelorenzo, eric.smith, levkivskyi
Date 2018-08-10.18:07:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533924465.6.0.56676864532.issue34363@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2018-08-10 18:07:45NeilGirdharsetrecipients: + NeilGirdhar, eric.smith, levkivskyi, alexdelorenzo
2018-08-10 18:07:45NeilGirdharsetmessageid: <1533924465.6.0.56676864532.issue34363@psf.upfronthosting.co.za>
2018-08-10 18:07:45NeilGirdharlinkissue34363 messages
2018-08-10 18:07:45NeilGirdharcreate