New submission from Guillaume Dominici <guillaumedomin...@gmail.com>:

The super proxy does not seem to forward call to .__str__() when the call 
occurs via str() function.
It may be an expected behavior, but it looks unexpected to me.

Minimal reproduction (tested on Python 3.6, but I believe may newer versions 
have similar behavior):

class Parent():
  def __str__(self):
    return "Parent"

class Child(Parent):
  def foo(self):
    s = super(Child, self)
    print(s.__str__())
    print(str(s))


c = Child()
c.foo()

# Output :
### Parent
### <super: <class 'Child'>, <Child object>>

----------
messages: 325976
nosy: Guillaume Dominici
priority: normal
severity: normal
status: open
title: str(super()) != super().__str__()
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34761>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to