"constructor" or initialization function for module

beginner zyzhu2000 at gmail.com
Sat Aug 18 21:43:43 EDT 2007


On Aug 18, 8:25 pm, Steve Holden <st... at holdenweb.com> wrote:
> 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 -------------

I see. That works.




More information about the Python-list mailing list