STINNER Victor <[email protected]> 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 <[email protected]>
<https://bugs.python.org/issue17576>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com