__div__ not recognized automatically
Peter Otten
__peter__ at web.de
Thu Nov 9 12:56:55 EST 2006
Anton81 wrote:
>> If you have the
>>
>> from __future__ import division
>>
>> statement, you need to override __truediv__(), not __div__()
>
> That worked after I also added
> from __future__ import division
> to all other modules I created.
>
> Is it possible that there appears an inconsistency if the division is
> imported in only some of the modules?
Yes. If you use your class with and without the __future__ option you have
to implement both __div__ and __truediv__, I suppose.
Peter
More information about the Python-list
mailing list