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

Is (and/or Why) __truediv__ are not patchable? #41

Open
chi2liu opened this issue Apr 10, 2020 · 1 comment
Open

Is (and/or Why) __truediv__ are not patchable? #41

chi2liu opened this issue Apr 10, 2020 · 1 comment

Comments

@chi2liu
Copy link

chi2liu commented Apr 10, 2020

Why doesn't it support __truediv __ attribute?
In python3. truediv replaces div
In Python2, the __truediv __ () method is used when __future __. division is in effect, otherwise __div __ () is used. If only one of these two methods is defined, the object will not support division in the alternate context; TypeError will be raised instead.

@kentkolze
Copy link

following the syntax of the file, I was able to get around this by adding ("truediv", "nb_true_divide"), ("itruediv", "nb_inplace_true_divide"), to as_number -- not sure if this has any unintended consequences, but it works for me in py3.6

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

2 participants