Newbie simple question - can't find answer

Grant Edwards grant at nowhere.
Tue Jan 11 10:53:28 EST 2000


In article <85fhha$6js$1 at nnrp1.deja.com>, eleisonme at juno.com wrote:
>Hello all,
>I am using Python 1.5.2-7 on intel Red Hat Linux 6.1.
>I do not seem to be able to use any of the math or cmath functions
>either in a script or on the python command line.
>
>For example if I type:
>>>>import math
>>>>exp (4)

You need to tell it which module contains "exp":

>>> math.exp(4)
54.5981500331
>>> 


Your other option is to explicitly import "exp" from the math
module into the global namespace.  This is discouraged (esp. in
larger applications), since it could result in namespace
collisions and confusing in a reader's mind about where "exp"
comes from:

>>> from math import exp
>>> exp(4)
54.5981500331
>>> 


-- 
Grant Edwards                   grante             Yow!  -- I have seen the
                                  at               FUN --
                               visi.com            



More information about the Python-list mailing list