Rather than defining
from numpy import cos as cos
from numpy import arccos as arccos
and so on, can I do something like
trigfunctions = ('cos','arccos','sin','arcsin','tan','arctan')
for method in trigfunctions:
setattr(HERE,method,getattr(numpy,method))
Where HERE
is either global space (or possibly, local function environment)? This would make it easier to define general functions based on cos
, arccos
without specifying the namespace, and loading the appropriate function from the desired module (e.g., math
if numpy
is not available). I realize that this can lead to errors when applied very generally, but in some small instances it would be useful.