◐ Shell
clean mode source ↗

Message 400747 - Python tracker

> 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.