Tim Tyler wrote:
Like C, Python seems to insist I declare functions before calling
them - rather than, say, scanning to the end of the current script
when it can't immediately find what function I'm referring to.

Yes and no. Yes, they have to exist before you can use them (that only makes sense), but no, they don't have to be placed in the same order in the source code like they do with C:


>>> def A(count):
...   print 'A', count
...   B(count + 1)
...
>>> def B(count):
...   print 'B', count
...   if count < 10:
...     A(count + 1)
...
>>> B(0)
B 0
A 1
B 2
...

See - all that matters is that they exist before you call them.

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

Reply via email to