overload builtin operator

Iain King iainking at gmail.com
Mon Aug 29 11:25:56 EDT 2005


Robert Kern wrote:
> Shaun wrote:
> > 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.
>
> You have silly users.

You mean you don't?  Damn.  Can I have some of yours?

Iain




More information about the Python-list mailing list