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.

Title: collections.UserString missing some str methods
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: Claudiu.Popa, Julian.Gindi, cvrebert, llllllllll, ncoghlan, orivej, python-dev, rhettinger, serhiy.storchaka, vstinner
Priority: Keywords: easy, patch

Created on 2014-08-13 05:49 by ncoghlan, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
userobjectmethods.patch llllllllll, 2015-04-15 21:28 review
Messages (8)
msg225255 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-08-13 05:49
str currently implements some methods that UserString doesn't:

>>> set(dir(str)) - set(dir(UserString))
{'__rmod__', 'casefold', 'isprintable', 'maketrans', 'format_map', '__getnewargs__'}

casefold, isprintable & format_map (and perhaps __rmod__) should likely be available on UserString as well.
msg226041 - (view) Author: Julian Gindi (Julian.Gindi) * Date: 2014-08-28 20:18
Good catch. I'm gonna look into this. Seems like you should be able to access these from UserString as well.
msg241166 - (view) Author: Joe Jevnik (llllllllll) * Date: 2015-04-15 21:28
I have added a patch to add these to UserString. I also wrote a test case that would check the UserString, UserList, and UserDict's methods to make sure that new methods to str, list, or dict (or the removal of one of those methods from the User* version) will cause a test failure.
msg243869 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-05-22 23:56
New changeset c06b2480766d by Raymond Hettinger in branch 'default':
Issue 22189:  Add missing methods to UserString
msg243870 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2015-05-22 23:57
Thanks Joe.
msg338850 - (view) Author: Orivej Desh (orivej) * Date: 2019-03-26 04:09
collections.UserString.__rmod__ references an undefined variable `args`:

    def __rmod__(self, format):
        return self.__class__(format % args)
msg338852 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-03-26 04:24
Orivej Desh, would you care to make PR to fix this (and add a test)?
msg338855 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-03-26 06:12
> collections.UserString.__rmod__ references an undefined variable `args`:

This is a duplicate of issue25652.
Date User Action Args
2022-04-11 14:58:06adminsetgithub: 66385
2019-03-26 06:12:12serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg338855

resolution: fixed
stage: needs patch -> resolved
2019-03-26 04:24:27rhettingersetpriority: low ->
status: closed -> open
resolution: fixed -> (no value)
messages: + msg338852
2019-03-26 04:09:45orivejsetnosy: + orivej
messages: + msg338850
2015-05-22 23:57:22rhettingersetstatus: open -> closed
resolution: fixed
messages: + msg243870
2015-05-22 23:56:41python-devsetnosy: + python-dev
messages: + msg243869
2015-04-15 21:28:58llllllllllsetfiles: + userobjectmethods.patch

nosy: + llllllllll
messages: + msg241166

keywords: + patch
2015-03-09 15:21:30serhiy.storchakasetkeywords: + easy
2015-03-09 14:55:30Claudiu.Popasetnosy: + Claudiu.Popa

versions: + Python 3.5
2014-08-29 03:10:37cvrebertsetnosy: + cvrebert
2014-08-28 20:18:30Julian.Gindisetnosy: + Julian.Gindi
messages: + msg226041
2014-08-16 12:20:21vstinnersetnosy: + vstinner
2014-08-13 06:38:14rhettingersetassignee: rhettinger

components: + Library (Lib)
nosy: + rhettinger
2014-08-13 05:49:12ncoghlancreate