[Python-Dev] True division in embedded Python

Tim Peters tim.one@comcast.net
Thu, 30 May 2002 00:02:37 -0400


[Bjorn Pettersen]
> ...
> Nope, we just want the advantage of the best language around while still
> using our 900KLoc of C++ libraries <wink>.

Then rather than play with true division now, you'll have a lot more fun
rewriting that in 9 lines of Python; C++/Python ratios of a million are
common for experienced Python programmers, but as a beginner don't feel bad
if you only get a factor of 100,000 savings.  By the way, you should become
a PSF sponsor too, and especially if you believed that <wink>.

> ...
> And if I'm reading the source correctly all I would have to do when
> embedding Python would be to set Py_DivisionWarningFlag = 1?

If you're trying to get the effect of passing -Qwarn to a standalone Python,
yes, that's all you need to do.  And #include'ing Python.h is all you need
to do to get at all names in Python's C API (Py_DivisionWarningFlag among
them).  Have fun!