Duncan Booth <[EMAIL PROTECTED]> writes: > Burton Samograd wrote: > > Is there any way to 'prototype' functions in python, as you would in > > C? Would that be what the 'global' keyword is for, or is there a more > > elegant or 'pythonic' way of doing forward references? > > > There isn't really such a thing as a forward reference in Python. Always > remember that 'def' and 'class' are executable statements:
Ok, we'll here's what I'm trying to do. I have a dictionary that I would like to initialize in a module file config.py: -- config.py ------------------------- global a_fun, b_fun dict = { 'a': a_fun, 'b': b_fun } -------------------------------------- where a_fun and b_fun are in fun.py: -- fun.py ---------------------------- def a_fun(): pass def b_fun(): pass import config def main(): config.dict['a']() config.dict['b']() main() -------------------------------------- I like having the module/namespace seperation with the configuration variables but I would like to make them easily (re)defined in the configuration file by the user. Does python have the idea of a 'weak' reference or lazy style evaluation for the definition of the dict in the config file above so I can achive what i'm tryin to do? -- burton samograd kruhft .at. gmail kruhft.blogspot.com www.myspace.com/kruhft metashell.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list