473,508 Members | 2,346 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

modules and namespaces

Hello,

I thought that this will work:

#m1.py
def f1():
return string.join('a','a')

#m2.py
def f2():
return string.join('b','b')

#main.py
import string
import m1
import m2

print f1()
print f2()

---------

However it doesn't work until I import the string module into m1 and m2
modules. I found in the manual that imported modules will be searched in
the container module first. Is it more efficient to import the string
module into main and m1 and m2 than importing only into m1 and m2?

Mage
Jul 19 '05 #1
0 1058

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2459
by: Andy Jewell | last post by:
Does anyone know of a way to dynamically reload all the imported modules of a client module? I'm writing a program that I have broken down into quite a few submodules, and the 'configuration'...
1
2053
by: Dan Williams | last post by:
Hi people I've just joined the Python list and although I'm sure my question must be asked fairly frequently, I have been unable to find an answer after two days of searching. For the record, my...
4
1975
by: Bart | last post by:
Hi all I don't understand globals between multiple modules in a python program. I really don't. I've narrowed it down to the following two very simple programs a.py and b.py. When I run a.py I...
12
2356
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...
5
373
by: Ben R. | last post by:
Hello, I’m in the process of reading "Inside Microsft .NET IL Assembler" by Serge Lidin to gain a better understanding of my .NET code at a lower (IL) level. There is one concept that I am...
5
1642
by: Alex | last post by:
Hi, this is my first mail to the list so please correct me if Ive done anything wrong. What Im trying to figure out is a good way to organise my code. One class per .py file is a system I like,...
17
2050
by: Neil Cerutti | last post by:
The Glk API (which I'm implementing in native Python code) defines 120 or so constants that users must use. The constants already have fairly long names, e.g., gestalt_Version, evtype_Timer,...
173
5563
by: Zytan | last post by:
I've read the docs on this, but one thing was left unclear. It seems as though a Module does not have to be fully qualified. Is this the case? I have source that apparently shows this. Are...
2
2300
by: deltaquattro | last post by:
Hi, I'm currently learning C++ and I would like to ask you the difference between Fortran 95 modules and C++ namespaces. To me they look the same, except for the scope operator :: in C++, which...
4
2450
by: Fabrizio Pollastri | last post by:
Hi, just an import problem: a program imports two modules, modA and modB, each module do not known anything about the other module (i.e. no cross imports in them), both modules needs to refer...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7123
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7495
tracyyun
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...
1
5052
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3181
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1556
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.