Skip to content

Fix collection(s) repr to correctly handle subclasses #3217

Closed

Description

@DimitrisJim

In CPython:

>>> from collections import deque
>>> class MyDeque(deque): pass
>>> MyDeque()
'MyDeque([])'

While in RustPython:

>>>>> from collections import deque
>>>>> class MyDeque(deque): pass
>>>>> MyDeque()
deque([])

This needs to be applied for set, frozenset and bytearray too.

Prior similar work: #3137

Activity

  1. changed the title [-]Fix deque.__repr__ to correctly handle subclasses[/-] [+]Fix collection(s) repr to correctly handle subclasses[/+] on Oct 4, 2021
  2. Snowapril commented on Oct 4, 2021

    @Snowapril
    Contributor

    currently, rustpython's repr is hardcoded with its name. maybe fix it with name method in pytype can be work.

  3. muscar commented on Oct 4, 2021

    @muscar
    Contributor
  4. DimitrisJim commented on Oct 4, 2021

    @DimitrisJim
    MemberAuthor

    Please request to work on issues and then someone can assign you (or, at the very least, leave a comment). #3218 and #3219 are in conflict. @muscar if possible, alter your PR to only fix the classes other than deque. This way both PRs can be merged!

    Please do request things though, it makes it easier for everyone involved 😄

  5. youknowone commented on Oct 4, 2021

    @youknowone
    Member

    well, claims will be respected but generally it is not necessary. (at least, we were not using that workflow before.)

    If there is no claim, first PR will be preferred to be merged without special reasons.

  6. DimitrisJim commented on Oct 4, 2021

    @DimitrisJim
    MemberAuthor

    it is not necessary

    Oh sure, I'm not saying otherwise. Requesting things just makes it easier and doesn't result in one of the PRs being closed (and possibly disheartening new contributors).

  7. muscar commented on Oct 5, 2021

    @muscar
    Contributor

    Fair enough :) Will as on any future ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions