forbiddenfruit icon indicating copy to clipboard operation
forbiddenfruit copied to clipboard

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

Open chi2liu opened this issue 5 years ago • 1 comments

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.

chi2liu avatar Apr 10 '20 03:04 chi2liu

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

kentkolze avatar Jul 08 '20 03:07 kentkolze