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
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
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
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
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
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