Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

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.

----------

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

Reply via email to