-
-
Notifications
You must be signed in to change notification settings - Fork 838
Make SomeIPythonRepr traverse the MRO for the type? #36801
Copy link
Copy link
Open
Labels
Description
Problem Description
Currently the implementation of SomeIPythonRepr just check the type of the function:
sage/src/sage/repl/display/fancy_repr.py
Lines 150 to 155 in b281350
| try: | |
| pretty_repr = self._type_repr[type(obj)] | |
| except KeyError: | |
| return False | |
| pretty_repr(obj, p, cycle) | |
| return True |
Would it be desirable to traverse the MRO instead?
What's the difference? This affects the printing when there's some user class inherit from one of the default IPython-printable classes.
sage: class A(list):
....: pass
sage: A([1..30])
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
sage: [1..30]
[1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30]The functionally equivalent code in IPython does break the lines in both cases.
Proposed Solution
Alternatives Considered
Additional Information
No response
Is there an existing issue for this?
- I have searched the existing issues for a bug report that matches the one I want to file, without success.
Reactions are currently unavailable