[Zope] Future watch: how will python division change affect zope?

Tom Jenkins tjenkins@devis.com
Tue, 24 Jul 2001 16:47:37 -0400


Hey all,
I was wondering if anyone here has given any (rational) thought on what 
python's PEP238 affects zope, zope coders and zope users.

For those of you that don't know, PEP238 which is still be thought 
about, will change  how the division operand ('/') works with integers. 
  Currently the following is what happens in python
int/int == int
2/1 == 2
3/2 == 1
3/4 == 0

under PEP238 this will change to
int/int == float
2/1 == 2.0
3/2 == 1.5
3/4 == 0.75

to do integer division you would have to use a _new_ operand ('//').

Now first off, this PEP has not been accepted (although Guido is leaning 
towards it), and there supposedly will be 2 years of warnings before it 
changes. But I'm not sure how the warnings are going to appear in dtml 
calls or the python methods?

I just checked and divmod is available so you could do
  <dtml-var expr="_.divmod[a,b][0]"> to get the same value as
  <dtml-var expr="a/b">.

I'm more concerned with the python methods that are out there or will be 
going out there.  Should we start coding defensively?  Maybe I should 
add a generic div method and have the folks here use that instead of '/'?

Thoughts?  Opinions?


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