from __future__ import ... within an RExec?

Erik Max Francis max at alcyone.com
Sun Aug 18 06:11:17 CEST 2002


Paul Rubin wrote:

> Erik Max Francis <max at alcyone.com> writes:
>
> > >>> x.r_exec('from __future__ import division')
> > >>> x.r_eval('1/2')
> > 0
> > but no such luck.  Trying to use the .r_import method directly also
> > didn't come up with anything.  I'm not getting an ImportError, just
> > nothing's happening.  Is there any way to do this within a RExec?
> 
> Use x.r_eval(1.0/2.0).

Um, I know how to do float division.  I'd like the / operator itself to
exhibit float division behavior.  I'm well aware of how to do float
division between two numbers; third parties are entering in expressions
to be evaluated and would prefer that the / operator exhibits float
division behavior rather than integer division.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ There is nothing so subject to the inconstancy of fortune as war.
\__/ Miguel de Cervantes
    Church / http://www.alcyone.com/pyos/church/
 A lambda calculus explorer in Python.



More information about the Python-list mailing list