[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docs lie)
STINNER Victor <vstinner@python.org> added the comment:
If we go in this direction we should add a DeprecationWarning for __str__() returning not direct str.
I saw str subclass being used for translation. Example: class Message(str): """A Message object is a unicode object that can be translated. Translation of Message is done explicitly using the translate() method. For all non-translation intents and purposes, a Message is simply unicode, and can be treated as such. """ https://github.com/openstack/oslo.i18n/blob/master/oslo_i18n/_message.py There is likely other funny use cases. I don't know if str() is used on Message instances. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17576> _______________________________________
participants (1)
-
STINNER Victor