By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,330 Members | 1,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,330 IT Pros & Developers. It's quick & easy.

"constructor" or initialization function for module

P: n/a
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?

Thanks,
Geoffrey

Aug 19 '07 #1
Share this Question
Share on Google+
2 Replies

P: n/a
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 -------------

Aug 19 '07 #2

P: n/a
On Aug 18, 8:25 pm, Steve Holden <st...@holdenweb.comwrote:
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.

Aug 19 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.