This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Arfrever, alex, barry, brett.cannon, docs@python, eric.snow, ethan.furman, mark.dickinson, mjacob, ncoghlan, python-dev, rhettinger, serhiy.storchaka, vstinner
Date 2021-08-31.15:42:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630424546.91.0.74394540992.issue17576@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2021-08-31 15:42:26vstinnersetrecipients: + vstinner, barry, brett.cannon, rhettinger, mark.dickinson, ncoghlan, Arfrever, alex, docs@python, ethan.furman, python-dev, eric.snow, serhiy.storchaka, mjacob
2021-08-31 15:42:26vstinnersetmessageid: <1630424546.91.0.74394540992.issue17576@roundup.psfhosted.org>
2021-08-31 15:42:26vstinnerlinkissue17576 messages
2021-08-31 15:42:26vstinnercreate