Re: Python Class use

2006-02-08 Thread bruno at modulix
S Borg wrote: > Hello, > > I am running Python on Mac OS X. The interpreter has been great for > learning the basics, but I would now like to be able to reuse code. > How do I write reusable code? I have done it "The Java way": write > the class, and save it to my home directory, then call it fr

Re: Python Class use

2006-02-07 Thread Magnus Lycka
Roel Schroeven wrote: > import MyModule > > x = MyModule.MyClass() > x.f() > > Or you could directly import MyClass into the global namespace like this: > > from MyModule import MyClass > > x = MyClass() > x.f() > > But that's not recommended since it clutters the global namespace and > makes

Re: Python Class use

2006-02-07 Thread Roel Schroeven
S Borg schreef: > Hello, > > I am running Python on Mac OS X. The interpreter has been great for > learning the basics, but I would now like to be able to reuse code. > How do I write reusable code? I have done it "The Java way": write > the class, and save it to my home directory, then call it

Re: Python Class use

2006-02-07 Thread Fabiano Sidler
Huh? You definitely must import that module. Then, is your homedir listed in sys.path? Greetings, F. Sidler -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Class use

2006-02-07 Thread Roy Smith
S Borg <[EMAIL PROTECTED]> wrote: > I am running Python on Mac OS X. The interpreter has been great for > learning the basics, but I would now like to be able to reuse code. Excellent. Code reuse is what it's all about! > How do I write reusable code? I have done it "The Java way": write > the c

Python Class use

2006-02-07 Thread S Borg
Hello, I am running Python on Mac OS X. The interpreter has been great for learning the basics, but I would now like to be able to reuse code. How do I write reusable code? I have done it "The Java way": write the class, and save it to my home directory, then call it from the interpreter, here