Confused with module and .py files

Satchidanand Haridas sharidas at zeomega.com
Wed Oct 5 04:46:56 EDT 2005


Iyer, Prasad C wrote:

>Actually I am bit confused between the modules and .py file
>How do I differentiate between the 2.
>
>  
>
A module 'name' is the same as the name of your file without the '.py' 
extension.

>For example
>I have a file import1.py, import2.py file
>Which has few functions and classes
>And if I have a class with same name "BaseClass" in both the file
>
>How would I use it if I declare it as given below in my 3rd class
>
>from import1.py import *
>from import2.py import *
>
>
>  
>
You should say :
from import1 import *
from import2 import *

If according to your earlier question, you have a class with the same 
name in two different modules, the better thing then (as others on the 
list have already pointed out) is to do the following:

import import1, import2

c1 = import1.MyClass()
c2 = import2.MyClass()

regards,
Satchit

----
Satchidanand Haridas (sharidas at zeomega dot com)

ZeOmega (www.zeomega.com)
Open  Minds' Open Solutions


>
>
>regards
>prasad chandrasekaran
>
>
>
>
>
>
>
>
>
>
>--- Cancer cures smoking
>
>#-----Original Message-----
>#From: python-list-bounces+prasad.c.iyer=capgemini.com at python.org
>#[mailto:python-list-bounces+prasad.c.iyer=capgemini.com at python.org] On
>#Behalf Of python-list-request at python.org
>#Sent: Wednesday, October 05, 2005 1:32 PM
>#To: python-list at python.org
>#Subject: Python-list Digest, Vol 25, Issue 65
>#
>#Send Python-list mailing list submissions to
>#	python-list at python.org
>#
>#To subscribe or unsubscribe via the World Wide Web, visit
>#	http://mail.python.org/mailman/listinfo/python-list
>#or, via email, send a message with subject or body 'help' to
>#	python-list-request at python.org
>#
>#You can reach the person managing the list at
>#	python-list-owner at python.org
>#
>#When replying, please edit your Subject line so it is more specific
>#than "Re: Contents of Python-list digest..."
>
>This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.
>
>  
>



More information about the Python-list mailing list