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 rhettinger
Recipients aganders3, aviramha, bar.harel, benjamin.peterson, brandtbucher, bukzor, georg.brandl, levkivskyi, methane, miss-islington, petr.viktorin, pitrou, rhettinger, serhiy.storchaka
Date 2022-01-23.21:59:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642975159.09.0.620461508011.issue46376@roundup.psfhosted.org>
In-reply-to
Content
I would really like this to be left alone.  We've been without a reliable version for over a decade.  That is strong evidence that we really don't need this unless it can be done perfectly (which it can't).  

Also, PyMapping_Check is just a CPython specific optimization (and a flawed one).  Because it can't be made completely reliable, we should not encourage people to use it, nor should we enshrine it in the stable API.

And if a modification can potentially break long stable code (such as that it the re module), then we absolutely shouldn't do it. x

Further, there is a general design issue.  Abstract base classes were invented to solve this specific problem (distinguishing mappings from sequences).  ABCs (and typing) are a now well established practice, and it is foolish to try to do an end run around using them.

I am strongly opposed to this going forward and request that a PEP be made if it is pursued further.   It is an SC level decision to allow stable code to be broken, to guarantee a CPython specific API for something that cannot be made correct in the general case, and to bypass the intended way to do it.

If the core concern is that isinstance() checks for ABCs are too slow, then efforts should be made to optimize them rather than creating an unreliable, CPython only alternative.
History
Date User Action Args
2022-01-23 21:59:19rhettingersetrecipients: + rhettinger, georg.brandl, pitrou, benjamin.peterson, petr.viktorin, methane, bukzor, aganders3, serhiy.storchaka, levkivskyi, bar.harel, miss-islington, brandtbucher, aviramha
2022-01-23 21:59:19rhettingersetmessageid: <1642975159.09.0.620461508011.issue46376@roundup.psfhosted.org>
2022-01-23 21:59:19rhettingerlinkissue46376 messages
2022-01-23 21:59:18rhettingercreate