forbiddenfruit
forbiddenfruit copied to clipboard
Is (and/or Why) __truediv__ are not patchable?
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.
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