Packages

Importing from a package

  • import Graphics.Primitives.fill
     Graphics.Primitives.fill.floodfill(img,x,y,color)
  • from Graphics.Primitives import fill
     fill.floodfill(img,x,y,color)
  • from Graphics.Primitivies.fill import floodfill
     floodfill(img,x,y,color)

Note:

  • On import, the __init__.py files in each subdirectory are executed.
  • Can be used to perform initialization of a subcomponent.
<<< O'Reilly OSCON 2000, Introduction to Python, Slide 110
July 17, 2000, beazley@cs.uchicago.edu
>>>