Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefined magic methods are not inherited #29

Open
voidworker opened this issue May 9, 2019 · 0 comments
Open

Redefined magic methods are not inherited #29

voidworker opened this issue May 9, 2019 · 0 comments

Comments

@voidworker
Copy link

voidworker commented May 9, 2019

Cursing object type is not working as expected.
It is ok for ordinary methods:

>>> from forbiddenfruit import curse
>>> curse(object, 'f', lambda x: print("boo"))
>>> [].f()
boo

But not for magic methods:

>>> from forbiddenfruit import curse
>>> curse(object, '__matmul__', (lambda x, y: y(x)))
>>> [1,2,3] @ len
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for @: 'list' and 'builtin_function_or_method'

Little testing shows that subclasses do not inherit redefined magic methods.

@alendit , please, could you pay some attention to this?

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

No branches or pull requests

1 participant