Hi,
If I write a module for general purpose use
that needs say, 'sys', 'os', 're' etc...
and I import those modules from within my module,
does this cause inefficiency when an existing program
that already imports these modules, imports mine,
or is there a safeguard similar to #ifdef MODULE_NAME
used in the C preprossessor?
Thanks,
Tobiah 2 1377
"Tobiah" <to**@rcsreg.com> wrote in message
news:82******************************@news.teranew s.com... Hi,
If I write a module for general purpose use that needs say, 'sys', 'os', 're' etc... and I import those modules from within my module, does this cause inefficiency when an existing program that already imports these modules, imports mine, or is there a safeguard similar to #ifdef MODULE_NAME used in the C preprossessor?
Python will only import a module once; if you ask for it
again, you'll get the reference that Python stores in an
internal table.
It's possible to get an incompletely loaded module if you
have two modules that import each other. That's a very
messy situation called a circular import, but you actually
have to do it to get into trouble.
John Roth Thanks,
Tobiah
> Python will only import a module once;
Thanks, this clears things up.
Tobiah This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Vsevolod (Simon) Ilyushchenko |
last post by:
Hi,
Last year I have written a Perl module to serve as a backend to
Macromedia Flash applications: http://www.simonf.com/amfperl
I have just rewritten it in Python, which I have not used...
|
by: Francisco Borges |
last post by:
Hello,
This is not stricly necessary but it would be nice if I could get it
done. Here is what I want to do:
There are 2 "foo" named modules, 'std foo' and 'my foo'. I want to be
able to...
|
by: qwweeeit |
last post by:
The pythonic way of programming requires, as far as I know, to spread a
big application in plenty of more manageable scripts, using import or
from ... import to connect the various modules.
In...
|
by: rh0dium |
last post by:
Hi all,
Basically I have a bunch of pluggins in a directory (METDIR). For each
one of these templated pluggins I want to do a specific routine. Let's
start with a basic template
file...
|
by: Joseph Turian |
last post by:
Can I simulate the behavior of "from foo import *" using
imp.load_module()?
Here's the functionality I need:
We allow the user to define parameter values, which are imported and
can be...
|
by: T. Crane |
last post by:
Hi,
When troubleshooting code that's saved in a text file, I often find that I
want to make a change to it, re-save it, then reimport it. However, just
typing
import myTestCode
doesn't...
|
by: rbygscrsepda |
last post by:
Hi, I'm a newbie at Python. :) Right now it's not letting me import *
from any relative package name--i.e., a name that starts with a dot.
For instance, none of the following work:
from . import...
|
by: Martin P. Hellwig |
last post by:
Hello all,
I had some troubles in the past how to arrange my packages and modules,
because I usually don't develop my stuff in the Lib\site-packages
directory I have some troubles when importing...
|
by: Hussein B |
last post by:
Hey,
Suppose I have a Python application consists of many modules (lets say
it is a Django application).
If all the modules files are importing sys module, how many times the
sys module will be...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |