from __future__ import ... within an RExec?

Erik Max Francis max at alcyone.com
Sat Aug 17 23:38:32 EDT 2002


I have a calculator-like tool that I make available to friends on a
private talker and have discovered that they'd prefer the / operator to
exhibit float division rather than integer division (mostly because a
previous tool behaved this way rather than for some a priori reason). 
I'm already doing the calculations in an RExec.rexec instance, so the
obvious thing to try seemed to be:

% python
Python 2.2 (#1, Feb  6 2002, 19:31:45) 
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rexec
>>> x = rexec.RExec()
>>> 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?

-- 
 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