Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collections.UserString missing some str methods #66385

Closed
ncoghlan opened this issue Aug 13, 2014 · 8 comments
Closed

collections.UserString missing some str methods #66385

ncoghlan opened this issue Aug 13, 2014 · 8 comments
Assignees
Labels
easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@ncoghlan
Copy link
Contributor

BPO 22189
Nosy @rhettinger, @ncoghlan, @vstinner, @orivej, @PCManticore, @serhiy-storchaka, @llllllllll
Files
  • userobjectmethods.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/rhettinger'
    closed_at = <Date 2019-03-26.06:12:12.859>
    created_at = <Date 2014-08-13.05:49:12.721>
    labels = ['easy', 'type-feature', 'library']
    title = 'collections.UserString missing some str methods'
    updated_at = <Date 2019-03-26.06:12:12.857>
    user = 'https://github.com/ncoghlan'

    bugs.python.org fields:

    activity = <Date 2019-03-26.06:12:12.857>
    actor = 'serhiy.storchaka'
    assignee = 'rhettinger'
    closed = True
    closed_date = <Date 2019-03-26.06:12:12.859>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2014-08-13.05:49:12.721>
    creator = 'ncoghlan'
    dependencies = []
    files = ['39054']
    hgrepos = []
    issue_num = 22189
    keywords = ['patch', 'easy']
    message_count = 8.0
    messages = ['225255', '226041', '241166', '243869', '243870', '338850', '338852', '338855']
    nosy_count = 10.0
    nosy_names = ['rhettinger', 'ncoghlan', 'vstinner', 'orivej', 'cvrebert', 'Claudiu.Popa', 'python-dev', 'serhiy.storchaka', 'Julian.Gindi', 'llllllllll']
    pr_nums = []
    priority = None
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue22189'
    versions = ['Python 3.5']

    @ncoghlan
    Copy link
    Contributor Author

    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.

    @ncoghlan ncoghlan added the type-feature A feature request or enhancement label Aug 13, 2014
    @rhettinger rhettinger added the stdlib Python modules in the Lib dir label Aug 13, 2014
    @rhettinger rhettinger self-assigned this Aug 13, 2014
    @JulianGindi
    Copy link
    Mannequin

    JulianGindi mannequin commented Aug 28, 2014

    Good catch. I'm gonna look into this. Seems like you should be able to access these from UserString as well.

    @llllllllll
    Copy link
    Mannequin

    llllllllll mannequin commented Apr 15, 2015

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 22, 2015

    New changeset c06b2480766d by Raymond Hettinger in branch 'default':
    bpo-22189: Add missing methods to UserString
    https://hg.python.org/cpython/rev/c06b2480766d

    @rhettinger
    Copy link
    Contributor

    Thanks Joe.

    @orivej
    Copy link
    Mannequin

    orivej mannequin commented Mar 26, 2019

    collections.UserString.rmod references an undefined variable args:

        def __rmod__(self, format):
            return self.__class__(format % args)

    573b44c#diff-8a750c700ae5ac1d0a14922de83e99ccR1109

    @rhettinger
    Copy link
    Contributor

    Orivej Desh, would you care to make PR to fix this (and add a test)?

    @rhettinger rhettinger reopened this Mar 26, 2019
    @serhiy-storchaka
    Copy link
    Member

    collections.UserString.rmod references an undefined variable args:

    This is a duplicate of bpo-25652.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants