Inclusion Guards Necessary?

K

Kamilche

Are inclusion guards necessary to prevent multiple modules from
importing the same shared module multiple times?

--Kamilche
 
M

Mike C. Fletcher

Kamilche said:
Are inclusion guards necessary to prevent multiple modules from
importing the same shared module multiple times?
No, multiple imports of a python module just do a lookup and return the
same module object as was returned by the previous import.

HTH,
Mike


________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
blog: http://zope.vex.net/~mcfletch/plumbing/
 
K

Kamilche

Mike C. Fletcher said:
No, multiple imports of a python module just do a lookup and return the
same module object as was returned by the previous import.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,201
Messages
2,571,047
Members
47,646
Latest member
xayaci5906

Latest Threads

Top