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 martin.panter
Recipients jcgoble3, martin.panter, pitrou, r.david.murray, rhettinger, serhiy.storchaka, xiang.zhang
Date 2016-07-10.23:23:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468193014.92.0.370454824453.issue25652@psf.upfronthosting.co.za>
In-reply-to
Content
Jonathon: Do you have a use case for __rmod__(), or did you find this bug by code analysis?

UserString.__rmod__() was added as part of Issue 22189. The main reason seems to be so that UserString has all the methods listed by dir(str). The result was that UserString.__rmod__() is documented as existing since 3.5.

Ideally I would agree with removing UserString.__rmod__(), but perhaps it would be safer to just have it return NotImplemented. As long as UserString properly supports all combinations of user_string_a % (user_string_b, user_string_c) etc, whether or how __rmod__() is implemented is an implementation detail. The existance of str.__rmod__() does not seem to be documented. It just seems to be a side-effect of how the C-level nb_remainder slot works.

For Serhiy’s F class, which explicitly only works with a single str argument, I think it is reasonable that using UserString instead would raise TypeError. This is what Python 2’s UserString does.
History
Date User Action Args
2016-07-10 23:23:34martin.pantersetrecipients: + martin.panter, rhettinger, pitrou, r.david.murray, serhiy.storchaka, xiang.zhang, jcgoble3
2016-07-10 23:23:34martin.pantersetmessageid: <1468193014.92.0.370454824453.issue25652@psf.upfronthosting.co.za>
2016-07-10 23:23:34martin.panterlinkissue25652 messages
2016-07-10 23:23:34martin.pantercreate