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 inconsisten
> 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
Try
a=(b+c)/NumX(2)
TV
Anton81 wrote:
> Hello!
>
> I wrote a class
>
> class NumX:
> ...
> def __add__(self,other):
> ...
> def __div__(self,other):
> if not isinstance(other,NumX): other=NumX(other)
> ...
>
> Somewhere else I use
>
> a=(b+c)/2
>
> where all variables are
Anton81 wrote:
> Hello!
>
> I wrote a class
>
> class NumX:
> ...
> def __add__(self,other):
> ...
> def __div__(self,other):
> if not isinstance(other,NumX): other=NumX(other)
> ...
>
> Somewhere else I use
>
> a=(b+c)/2
>
> where all variables are of NumX Type. When I exec
Anton81 <[EMAIL PROTECTED]> wrote:
> class NumX:
>...
>def __add__(self,other):
> ...
>def __div__(self,other):
> if not isinstance(other,NumX): other=NumX(other)
> ...
>
> Somewhere else I use
>
> a=(b+c)/2
>
> where all variables are of NumX Type. When I execute
On Thu, 02 Nov 2006 12:59:32 +0100, Anton81 wrote:
> When I execute the program it
> complains that it can't find an operator "/" for "instance" and "integer".
How about if you post the actual traceback you get, rather than
paraphrasing? That way, we don't have to guess.
--
Steven.
--
http:/
Hello!
I wrote a class
class NumX:
...
def __add__(self,other):
...
def __div__(self,other):
if not isinstance(other,NumX): other=NumX(other)
...
Somewhere else I use
a=(b+c)/2
where all variables are of NumX Type. When I execute the program it
complains that it can't find an