First page Back Continue Last page Overview Graphics

Renaming a Namespace

While importing a module, the name of the namespace can be changed:

>>> import math as m

>>> print(m.cos(m.pi))

-1.0

After this import there exists a namespace m but no namespace math.

>>> from math import pi,pow as power, sin as sinus

>>> power(2,3)

8.0

>>> sinus(pi)

1.2246467991473532e-16