overload builtin operator
Shaun
shaung at netspace.net.au
Sat Aug 27 04:55:40 CEST 2005
Thanks for your replies, obviously this isn't a simple thing to do so
I'll take a different tack.
The exact problem I am trying to solve here is to avoid the
ZeroDivisionError in division.
I have c++ code which delegates to python to calculate expressions on
table cells. The values of the table cell are arbitary numbers and the
expressions to be calculated are fairly simple python arithmetic and
math functions.
The problem being that some users want an expression like '(100/x)+ 3'
where x=0 to return 3. So that dividing a number by zero results in 0.
Apart from parsing the expression string myself and checking for divide
by zero I can't find another way to solve the problem.
Hopefully someone out there has some ideas.
Thanks,
Shaun.
More information about the Python-list
mailing list