[Python-Dev] True division in embedded Python
Alex Martelli
aleax@aleax.it
Wed, 29 May 2002 22:32:02 +0200
On Wednesday 29 May 2002 10:15 pm, Bjorn Pettersen wrote:
> We're currently in the process of adapting Python as the common
> scripting plug-in for all of our projects (and it's working great :-).
Great idea.
> We're standardizing on 2.2.1, and unless there is a pressing business
> need, we'll probably stay with that version for the next 18-24 months.
Interestingly enough, the same target-range mentioned by many
business users and therefore targeted by the Python Business Forum.
See www.python-in-business.org (if it doesn't answer yet -- doesn't
to me -- pbf.nuxeo.com should for the moment be equivalent).
> My question is if it's intended for users to start using true division
> _now_? The reason I'm inclined to do so is that we're going to have
> snippets of Python code everywhere, including our libraries, disk files,
> and databases -- it would be a major undertaking to find and fix this
> later...
Since you're looking forwards, adopting true division seems sensible.
> My second question is how do you enable true division in embedded
> Python? I've read the documentation and I couldn't find anything
> appropriate...
>
> Any insight would be greatly appreciated.
See Modules/main.c line 153 ff, where it handles the -Q option.
Unfortunately it seems this requires setting a flag whose name
starts with an underline, _Py_QnewFlag, therefore an internal
interface -- however, hopefully it won't go away as long as you're
staying with the 2.2.[1+] "family" (surely it won't change in 2.2.1
itself, of course, but even should you want to upgrade to 2.2.2 or
whatever in the future to gain bugfixes or optimizations, it seems
to me you should be safe on this point).
Alex