class creation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • km

    class creation

    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

  • Alex Martelli

    #2
    Re: class creation

    km wrote:
    [color=blue]
    > 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 ?[/color]

    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

    Comment

    Working...