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. Also, since 2.3, if you want a subclass of str you can just subclass str; if you use UserString instead, you have some reason for doing so, and that reason might include not being a subclass of str. If this were a common problem, you’d probably want to add a collections.abc.String, which would register both str and UserString, and allow people to register independent string types, and then people would check with `(String, ByteString)` instead of `(str, ByteString)`. But I think the need for that just doesn’t come up often enough for anyone to ask for it. Personally, I use third-party string types–mostly bridge types like objc.NSString or js.String—a lot more often than I build strings out of UserString. _______________________________________________ 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/TXCYQJAC5QQUUYQKGAQSELTWDVNEFYXI/ Code of Conduct: http://python.org/psf/codeofconduct/
