473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

campaining for PEP 238 - integer division

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
Jul 18 '05 #1
2 1894
"Sebastian Haase" <se*******@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
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

Cheers,
Sebastian Haase

Jul 18 '05 #2
Sebastian Haase wrote:
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...

--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Imbaud Pierre | last post by:
integer division and modulo gives different results in c and python, when negative numbers are involved. take gdb as a widely available c interpreter print -2 /3 0 for c, -1 for python. more...
15
by: joel | last post by:
I have a table which I want to update by dividing one field into another. The update runs with no errors, but the results come out as only a positive integer number. The datatype for the result...
24
by: Teis Draiby | last post by:
In .NET, can I be sure that the result of a division between two integers always is truncated rather that rounded to nearest? Example: 99 / 50 = 1 regards, Teis
17
by: seb.haase | last post by:
Hi, Is it true that that "Python 3000" is dead ? Honestly I think that e.g. changing 5/2 to be 2.5 (instead of 2) would just break to much code :-( On the otherhand I'm using Python as "Matlab...
10
by: Mike S | last post by:
Does anyone know the logic behind why in VB.NET the result of a floating-point division ('/') is -rounded- on being converted to an integer type, such as with statements like Dim x As Integer =...
9
by: PengYu.UT | last post by:
Hi, The usually integer division will round the result to the biggest integet smaller than the float version division.For example, 10/3 = 3. I'm wondering if there is any easy way to round it...
2
by: kermit | last post by:
For a long time,, There has been a discussion of trueFor division versus integer division in Python. I myslef prefer that / be used for integer division since almost always, I want the...
13
by: jamesonang | last post by:
Supposed unsigned int(32 bits) is the largest number that computer can represent with a single variable. Now, i have a big integer ( less than 64 bit, but great than 32 bit) . i represent it by...
16
by: spl | last post by:
To increase the performance, how to change the / operator with bitwise operators? for ex: 25/5, 225/25 or 25/3 or any division, but I am not bothered of any remainder.
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.