using identifiers before they are defined
juliosergio at gmail.com
Tue Jun 12 20:33:06 CEST 2012
Jose H. Martinez <josehmartinezz <at> gmail.com> writes:
> You should define the function first and then call it.
> def something(i): return i
> a = something(5)
> If you want a reference to the function somewhere else you can do this:
I know that. That was what I meant by "changing the order of the definitions
will work" in my original message.
And I insist in the issue, which is not trivial... In my message I mentioned
"crossed recursion", and I delve into it here:
Suppose I have to define two functions, aa, and, bb that are designed to call
... a call of bb() somewhere in the body of aa
... a call of aa() somewhere in the body of bb
Whatever the order of definition of aa and bb the problem remains, one of the
two identifiers is not known ...
Most of computer languages have mechanisms to deal with this issue. Is there any
in Python or it is in disadvantage with respect to other languages like C++,
Java, Perl, PHP, etc.?
More information about the Python-list