Andrew Barnert wrote:
> On Oct 14, 2019, at 13:28, Steve Jorgensen [email protected] wrote:
> > Andrew Barnert wrote:
> > On Oct
> > 14, 2019, at 07:15, Steven D'Aprano [email protected] wrote:
> > Speaking of UserString, does anyone know why it isn't
> > registered as a 
> > virtual subclass of str?
> > None of the concrete classes register virtual subclasses, so this would be a
> > unique exception.
> > See the final lines in 
> > https://github.com/python/cpython/blob/3.7/Lib/_collections_abc.py
> > MutableSequence.register(list)
> >    MutableSequence.register(bytearray)  # Multiply inheriting, see 
> > ByteString
> > But that’s the exact opposite: it registers list and bytearray as virtual
> subclasses of the ABC MutableSequence, it doesn’t register MutableSequence as 
> a virtual
> subclass of the concrete classes list and bytearray. Doing the latter would 
> not only (like
> Steven’s proposal) be unprecedented and require changes to builtin types, but 
> also
> (completely unlike Steven’s proposal) be just wrong—it’s certainly not true 
> in any useful
> sense that every mutable sequence is usable as a bytearray.

Ah! Yes. I hadn't read carefully enough.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/BOCOGNYY4YRIDQAWXMOQQZGGQCTHRQUE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to