On Mon, 2006-12-04 at 14:03 -0800, king kikapu wrote: > I recap: if i put only functions declarations on a .py file, like > these: > def A(): print "a" > def B(): print "b" > def C(): print "c" > > and run the program, nothing happens, nothing executed.
Nothing *visible* happens. The "def" statements *do* get executed. Executing the statement def A(): print "a" does the following, roughly, modulo irrelevant implementation details: * The function body gets compiled into byte code (but not executed). * A callable object with the byte code for the compiled function body is constructed. * The thusly constructed callable object is bound to the name A in your current namespace. So, a lot of stuff happens when the interpreter executes a def statement, but that stuff is not visible to you. Hope this helps, Carsten. -- http://mail.python.org/mailman/listinfo/python-list