"constructor" or initialization function for module

Steve Holden steve at holdenweb.com
Sat Aug 18 21:25:06 EDT 2007


beginner wrote:
> Hi Everyone,
> 
> An extended module (.pyd) written in C have an init function that is
> called when the module is imported. Does anyone know if there is a way
> to provide an init function for a module written in python?
> 
The body of a Python module is executed the first time it is imported 
(that's how the functions and classes get defined: class and def 
statements are executable), so just put your initialization code inline.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------




More information about the Python-list mailing list