[Image-SIG] Will 1.1.7 be true-division safe ?
seb.haase at gmail.com
Sat May 30 10:50:24 CEST 2009
On Sat, May 30, 2009 at 2:23 AM, Fredrik Lundh <fredrik at pythonware.com> wrote:
> On Sat, May 30, 2009 at 12:50 AM, Christopher Barker
> <Chris.Barker at noaa.gov> wrote:
>>> "True division" can also be spelled "float(x) / y", and that spelling
>>> works in all Python versions (and is used in plenty of places in PIL).
>> yes, but he asking for the // operator, which I think is spelled:
>> math.floor(x / y)
>> except that that does a float conversion for integer operators.
> Or just plain "/" in the context where it's used in PIL.
> I still fail to see what a change would buy anyone, given that there
> will *never* be a Python 2.X release that doesn't treat "/" the way
> it's treated in today's 2.X. It's not like you cannot use "//" in
> your own code...
> (Is the problem here that people think that the -Q option should be
> used for anything other than 3.X compatibility testing? Writing code
> for 2.X that depends on -Qnew is not the right thing do to; please use
> the "from __future__ import division" module-level pragma instead.)
(referring to the last paragraph:)
You are probably correct. ((Except using '//' does not *depend* on
-Qnew -- the '//' operator works the same with and without -Q))
However, we use python mostly in an interactive mode - essentially as
a Matlab substitute.
And using -Qnew has worked for this very well for more than a year or so.
At first there were some other third party libraries (like scipy and
sympy) that had trouble with this, but since they don't want to
support Python 1.5 they could apply the '//'-patches.
So after I fixed those 5-10 or so places in PIL 1.1.6 everything
worked -- even with -Qnew.
It would not be hard to do the same with 1.1.7 - only less elegant ...
(that's why I was asking)
(('//' was introduced with Python 2.2 in Dec 2001,
Regards and thanks for PIL,
More information about the Image-SIG