Python Library Question

Markus Schaber markus at schabi.de
Thu Aug 23 03:41:45 EDT 2001


Hi,

Jeff Shannon <jeff at ccvcorp.com> schrub:

> When you are using functions (or other attributes) from an imported
> module, you have to prepend the module name--in effect, you're telling
> the
> interpreter *where* to find that function.  So try:
> 
>>>> import math
>>>> x = 2
>>>> y = math.exp(2)
>>>> y
> 7.3890560989306504

Another way would be:

>>> from math import exp
>>> exp(2)
7.38905609893
>>> 

As you know, there's always _one_ obvious way to do it, but this only 
way may have just lots of lanes :-)

markus
-- 
1) Customers cause problems.
2) Marketing is trying to create more customers.
Therefore:
3) Marketing is evil.  (Grand Edwards in comp.lang.python)



More information about the Python-list mailing list