Newbie simple question - can't find answer

Skip Montanaro skip at mojam.com
Tue Jan 11 10:47:56 EST 2000


    Rachel> For example if I type:
    >>>> import math
    >>>> exp (4)

Try this instead:

    import math
    math.exp(4)

Import brings one or more names into the current namespace.  The simple form
you used above associates a name, "math", with the math module object.  If
you had executed

    from math import exp

or

    from math import *

you would have had a variable called "exp" associated with the math.exp
function in your local namespace and could have executed a bare exp(4).

Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/
847-971-7098




More information about the Python-list mailing list