Skip to content

Conversation

@BCSharp
Copy link
Member

@BCSharp BCSharp commented Apr 8, 2025

This PR changes the repr() on the builtin container types for their subclasses to display the subclass name rather than always the root base type. Similarly what is already done for set: repr(set() is set() but if class MySet(set): pass is defined, repr(MySet()) is MySet(). The changed container types are:

  • bytearray
  • array.array
  • collections.defaultdict
  • collections.deque

This change has been implemented in Python 3.7. but in 3.4 - 3.6 there is one test in StdLib that catches the base class name; this has been upgraded here to the test from 3.7.

Copy link
Contributor

@slozier slozier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@BCSharp BCSharp merged commit df82b68 into IronLanguages:main Apr 10, 2025
17 checks passed
@BCSharp BCSharp deleted the container_repr branch April 10, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants