On Sun, Nov 22, 2020 at 07:28:00PM -0000, Jonatan  wrote:

> somehow, The expression "super() <OPERATOR> other" does not turn into 
> "super().__OPERATOR__(other)".

Is there something documented that lead you to believe that it should?

By the way, for most operators, there is no simple relationship between 
the operator and the dunder method called. For example, consider 
addition `x + y`. The interpreter does something *roughly* like this:


    if y is a subclass of x:
        try calling y.__radd__(x)
        if it doesn't exist, or if it returns NotImplemented,
        try calling x.__add__(y)
        if it doesn't exist, or returns NotImplemented,
        raise TypeError
    otherwise:
        try calling x.__add__(y)
        if it doesn't exist, or if it returns NotImplemented,
        try calling y.__radd__(x)
        if it doesn't exist, or returns NotImplemented,
        raise TypeError


only I expect I have the details wrong and it may be even more 
complicated. The point is, `super() operator other` will not, in 
general, turn into a single dunder method, but potentially two or maybe 
even more.


> this bug is for any operator that you apply on super().
> I'd be happy to hear from you why it happens and whether will it be fixed in 
> python3.10.

Before we can "fix" it, we have to agree that it is a bug and that it 
should be fixed. What gives you the impression that this is a bug?

Is the behaviour documented somewhere as working?

If we made this change, would it extend to other dunder methods like 
`__str__`, `__len__`, `__enter__`, etc?



-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/ZBAYSKK7QDE52QP7PC6UR5OMSVX7NMDW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to