On Tuesday 08 March 2005 12:41, Martin MOKREJŠ wrote:
> cat somefile.py
> a = 222
> b = 111
> c = 9
>
> cat anotherfile.py
>
> def a():
>     include somefile
>     postprocess(a)

What about :
def a():
  exec open('somefile.py')
  postprocess(a)

You can even use the optional dictionary parameter:

class klass(object):
  pass

a = klass()

exec open('somefile.py') in a.__dict__

print a.a, a.b, a.c
222 111 9

Cheers,

BranoZ

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to