[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Importing Modules

PEYMAN ASKARI

3/10/2010 12:19:00 PM

Hello

I frequent the PyGtk mailing list all the time, but this is the first time I am posting here =)

I wanted to know if imported classes are treated differently than internal classes.

I have attached a minimal example which points out what I mean. Essentially, if I create a class:

class A():
 __init__(self):
  pass

and call A, or A() I get something to the effect of  <__main__.A instance at 0xb7f088ac>

but if I call from module_name import A and then call A or A() I get something to the effect of  <module_4.module_4 instance at 0xb7f0882c>

I was wondering if this would be a problem.

I have included the test_import.py file as well as 4 module files which it loads. Save the tes_import.py file to a folder, create another folder there, and save ONLY the 4 modules files to that new folder. In the code, update line 26 to reflect to path of the newly created directory

Thanks in advanced


Peyman