class creation

K

km

Hi all,

If i create a class "REX" and want to import it and test its implementation in a python script what should be the file name of the class file be ?

kindly enlighten,
thanks,
KM
 
A

Alex Martelli

km said:
Hi all,

If i create a class "REX" and want to import it and test its
implementation in a python script what should be the file name of the
class file be ?

Whatever you wish, as long as the extension is .py and you place
the file in some directory along Python's sys.path.

For example, if your "class REX:" (etc) is located in blaugh.py
in the current directory,

import blaugh
r = blaugh.REX()

is how you instantiate the class to get an instance r you can
call methods on.


Alex
 

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,173
Messages
2,570,937
Members
47,481
Latest member
ElviraDoug

Latest Threads

Top