I ran across a weird situation using Brython and inheritance with the str method. Here's my test using the Brython console:
>>> class A(object):
... def __str__(self):
... return "A __str__ output."
...
>>> class B(A):
... def __str__(self):
... return super().__str__() + " (from B)"
...
>>> x = A()
>>> x
<__main__.A object>
>>> y = B()
>>> y
<__main__.B object>
>>> str(y)
"<super: <class 'B'>, <B object>> (from B)"
I was expecting that last line to return:
"A __str__ output. (from B)"
Am I doing something wrong here?
The same code works fine in CPython, so it's probably a Brython bug.
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class A(object):
... def __str__(self):
... return "A __str__ output."
...
>>> class B(A):
... def __str__(self):
... return super().__str__() + " (from B)"
...
>>> x = A()
>>> x
<__main__.A object at 0x1048de590>
>>> y = B()
>>> y
<__main__.B object at 0x1048de790>
>>> str(y)
'A __str__ output. (from B)'
>>>