Logged In: YES
user_id=99508
In my particular usecase, I define an environment in which
people can execute mathematical statements like so:
_mathEnv = {'__builtins__': new.module('__builtins__'), 'i': 1j}
_mathEnv.update(math.__dict__)
_mathEnv.update(cmath.__dict__)
As you can see, the cmath definitions shadow the math
definitions, and thus I lose the useful ability to offer
users a log with a base (which those that know Python expect
to work).
That's at least my particular use case. In this particular
instance, since I don't want to allow the users to cause the
application to consume arbitrary amounts of memory, I can't
allow integer arithmetic (because of the crazy int/long
unification that left people who wanted computationall
bounded arithmetic with no choice but to implement a
fixed-size integer type or use float/complex instead ;)) so
I use complex objects everywhere, and math.log can't operate
on complex objects (even those that have no imaginary
component).
|