On Mon, Jun 29, 2009 at 10:03 AM, Robert Lummis <robert.lum...@gmail.com>wrote:

> ... or any pre-processing at all?
>
> I'm looking for a way to get boiler plate code into the main program
> file. Of course I could copy and paste it with an editor but I was
> hoping for something more pythonic. I know about import but that's not
> the same.
>

actually import is precisely the same.

 wa...@x61:test$ vi import1.py
wa...@x61:test$ vi import2.py
wa...@x61:test$ python import1.py
Imported

The contents of import1?

import import2

The contents of import2?

print "Imported"

You can define functions, classes, etc.

you call them as whatever.function(), unless you say

from module import * - then it willl import everything into the namespace of
your original file.

HTH,
Wayne
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to