campaining for PEP 238 - integer division

S

Sebastian Haase

Hi,
I'm interested in having more people in our lab using numarray/NumPy
instead of MatLab. For that I have put together a couple useful
modules and written many myself. But then I got reminded of a new /
upcoming feature of Python:
"2/3 == 1.5" AKA PEP 238.
I'm very interested in putting lots of
"from __future__ import division"
lines into my code especially since numarray (the new NumPy) now
supports it.

QUESTION: Is this new/upcoming feature of Python mentioned enough ?
Like in the Python tutorial or mailing lists ...
A google groups search for "python 238 integer OR division" was
giving me one relevant result from Jan2004, another one from May2003,
all else even older !!!

I think people need to be reminded that PEP238 is really happening
and especially new people should be pointed to this --
The fact is that changing something as fundamental as the division
operator WILL BRAKE LOTS OF CODE !! I'm just thinking of all the
'a[n/2]' expressions I have in my code.

PROPOSAL: This is why I would like to see some special treatment for
PEP 238. If the division operator is going to change this should be
noted right in the first chapter of the Python tutorial (Python as
calculator). Remind all python developers that they will have to
change their code. (Actually: is there an easy 'fix' like "from
__past__ import division" ?)

Cheers,
Sebastian Haase
 
J

John Roth

Sebastian Haase said:
Hi,
I'm interested in having more people in our lab using numarray/NumPy
instead of MatLab. For that I have put together a couple useful
modules and written many myself. But then I got reminded of a new /
upcoming feature of Python:
"2/3 == 1.5" AKA PEP 238.
I'm very interested in putting lots of
"from __future__ import division"
lines into my code especially since numarray (the new NumPy) now
supports it.

QUESTION: Is this new/upcoming feature of Python mentioned enough ?
Like in the Python tutorial or mailing lists ...
A google groups search for "python 238 integer OR division" was
giving me one relevant result from Jan2004, another one from May2003,
all else even older !!!

According to the current version of the PEP, that change won't
happen until sometime in the misty future with version 3.0. That
release is scheduled to break lots of things, not just this one.

The PEP contains recommendations for cushioning the shock.

John Roth
 
G

Greg Ewing

Sebastian said:
The fact is that changing something as fundamental as the division
operator WILL BRAKE LOTS OF CODE !!
^^^^^

Ah, so *that's* why my code isn't running fast enough...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top