[Python-Dev] True division in embedded Python
Bjorn Pettersen
BPettersen@NAREX.com
Wed, 29 May 2002 20:42:52 -0600
> From: Tim Peters [mailto:tim.one@comcast.net]=20
>=20
> [Bjorn Pettersen]
[snip: me asking whether I should turn on true division]
> Nevertheless, I recommend you not try to enable true division=20
> now. Part of the joy of Python is sharing the many libraries=20
> and extension modules people freely provide, and so far=20
> nothing except the core distribution is tested with true=20
> division enabled -- and even in the core, true division is=20
> tested sporadically and lightly. You don't want to be a=20
> pioneer here, unless advancing true division is your business <wink>.
Nope, we just want the advantage of the best language around while still
using our 900KLoc of C++ libraries <wink>.
> That said, in 2.2.x, you can start using // *now* when you=20
> intend flooring integer division. That's already=20
> implemented. 5/3 will also produce 1 for now, but don't do=20
> it -- do 5//3 instead.
>=20
> Also read the PEP:
>=20
> http://www.python.org/peps/pep-0238.html
>
> Guido has implemented some quite elaborate mechanisms to=20
> help with the transition, and if you start using i//j now=20
> you *should* have a very easy time when Python 3 changes=20
> the rules (indeed, you shouldn't need any division changes=20
> later, provided you use // now). The simplest of the=20
> mechanisms is -Qwarn:
And if I'm reading the source correctly all I would have to do when
embedding Python would be to set Py_DivisionWarningFlag =3D 1?
Thanks for the detailed input.
Sincerely,
Bjorn Pettersen
NAREX Inc.
303.526.4000 ext. 312
303.526.5130 fax
www.narex.com