Sie sind auf Seite 1von 1

###################### 18.

3 A concrete example
-------------------------- File mathproj/__init__.py ----------------------print "Hello from mathproj init"
__all__ = ['comp']
version = 1.03
-------------------------- File mathproj/comp/__init__.py -----------------__all__ = ['c1']
print "Hello from mathproj.comp init"
-------------------------- File mathproj/comp/c1.py -----------------------x = 1.00
-------------------------- File mathproj/comp/numeric/__init__.py ---------print "Hello from numeric init"
-------------------------- File mathproj/comp/numeric/n1.py ---------------from mathproj import version
from mathproj.comp import c1
from n2 import h
def g():
print "version is",version
print h()
-------------------------- File mathproj/comp/numeric/n2.py ---------------def h():
return "Called function h in module n2"

Das könnte Ihnen auch gefallen