[Zope] Future watch: how will python division change affectzo pe?

Tom Jenkins tjenkins@devis.com
Thu, 26 Jul 2001 11:49:13 -0400


Farrell, Troy wrote:

> I'm not sure about everyone's idea on this, but Backward Compatibility 
> is a
> Good Thing(tm).
> Why don't we just say:
> 1/2  == 0
> 1//2 == 0.5
>
> Troy
>
 
 
Long discussions (and flames) about this on c.l.py...

But this change is going in.  It won't go in until Python 3.0, per Guido 
(how is now a co-author of the PEP).  It also means it will be 
_at_least_ 2 years before Python 3.0 (and hence this change) comes out.

Now there is a warning mechanism that will be in place, however I don't 
know how (or even IF) the zope mechanism will surface to the Python 
Methods or *gasp* dtml writers any warnings.

We're probably going to write 2 external functions: intdiv and floatdiv
and use those in place of '/'

def intdiv(x, y):
   return int(divmod(x,y)[0])

def floatdiv(x,y):
   return float(x)/y

although I think gozinta may be a better name for intdiv ;)



-- 
Tom Jenkins
devIS - Development Infostructure
http://www.devis.com