Re: overload builtin operator

2005-08-29 Thread Bengt Richter
On Sun, 28 Aug 2005 23:27:07 -0400, "Terry Reedy" <[EMAIL PROTECTED]> wrote: >I suspect that PyPy, when further alone, will make it easier to do things >like develop a customized interpreter that has alternate definitions for >builtin operators. So maybe the OP should ask again in a year or two

Re: overload builtin operator

2005-08-29 Thread Robert Kern
Iain King wrote: > Robert Kern wrote: >>You have silly users. > > You mean you don't? Damn. Can I have some of yours? No, you may not. Mine! All mine! -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard H

Re: overload builtin operator

2005-08-29 Thread Iain King
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 calcul

Re: overload builtin operator

2005-08-28 Thread Terry Reedy
I suspect that PyPy, when further alone, will make it easier to do things like develop a customized interpreter that has alternate definitions for builtin operators. So maybe the OP should ask again in a year or two. TJR -- http://mail.python.org/mailman/listinfo/python-list

Re: overload builtin operator

2005-08-28 Thread Bengt Richter
On Sun, 28 Aug 2005 04:09:10 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: [... a response to the OP's apparent desire to "overload the divide operator" with a call to his safediv function ...] The part that rewrote the the AugAssign could only work for plain name Augassign targets, so I introd

Re: overload builtin operator

2005-08-27 Thread Bengt Richter
On Thu, 25 Aug 2005 16:12:20 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: >Shaun wrote: >> Hi, >> >> I'm trying to overload the divide operator in python for basic arithmetic. >> eg. 10/2 ... no classes involved. >> >> I am attempting to redefine operator.__div__ as follows: >> >>

Re: overload builtin operator

2005-08-26 Thread Robert Kern
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.

Re: overload builtin operator

2005-08-26 Thread Shaun
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 ce

Re: overload builtin operator

2005-08-26 Thread Bengt Richter
On Thu, 25 Aug 2005 16:12:20 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: >Shaun wrote: >> Hi, >> >> I'm trying to overload the divide operator in python for basic arithmetic. >> eg. 10/2 ... no classes involved. >> >> I am attempting to redefine operator.__div__ as follows: >> >>

Re: overload builtin operator

2005-08-25 Thread Reinhold Birkenfeld
Shaun wrote: > Hi, > > I'm trying to overload the divide operator in python for basic arithmetic. > eg. 10/2 ... no classes involved. > > I am attempting to redefine operator.__div__ as follows: > > # my divide function > def safediv(a,b): > return ... > > # reassign bui

Re: overload builtin operator

2005-08-25 Thread Robert Kern
Shaun wrote: > Hi, > > I'm trying to overload the divide operator in python for basic arithmetic. > eg. 10/2 ... no classes involved. > > I am attempting to redefine operator.__div__ as follows: > > # my divide function > def safediv(a,b): > return ... > > # reassign bui

overload builtin operator

2005-08-25 Thread Shaun
Hi, I'm trying to overload the divide operator in python for basic arithmetic. eg. 10/2 ... no classes involved. I am attempting to redefine operator.__div__ as follows: # my divide function def safediv(a,b): return ... # reassign buildin __div__ import operator