[Cython] __future__.division on constants and C integers
Stefan Behnel
stefan_ml at behnel.de
Sat Jul 4 18:01:54 CEST 2009
Hi,
quick update:
Stefan Behnel wrote:
> My fix would be to handle future division in the parser (instead of code
> generation, as it is now), and to let the parser directly replace "/" by
> "//" when future division is *not* enabled, so that the "/" operator can
> always have true division semantics when it appears inside the parse tree.
That won't work, since "/" and "//" do different things to integers and
floats. So this can't be decided before the type analysis phase, which runs
after the constant folding phase...
I guess all we can do for now is to ignore "/" during constant folding and
then handle it when we know the operand types...
Stefan
More information about the Cython-dev
mailing list