Julio Sergio writes:
> Suppose I have to define two functions, aa, and, bb that are designed
> to call each other:
>
> def aa():
> ...
> ... a call of bb() somewhere in the body of aa
> ...
>
> def bb():
> ...
> ... a call of aa() somewhere in the body of bb
> ..
Julio Sergio wrote:
Ethan Furman stoneleaf.us> writes:
No. The reply from MRAB explains this.
~Ethan~
Thanks, you're right!
I was confusing statemens with declarations.
Yeah, it took me a while to get that straight as well.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-lis
Ethan Furman stoneleaf.us> writes:
>
>
> No. The reply from MRAB explains this.
>
> ~Ethan~
>
Thanks, you're right!
I was confusing statemens with declarations.
--
http://mail.python.org/mailman/listinfo/python-list
Seems like what you need is
from othermodule import bb
def aa():
bb()
On Tue, Jun 12, 2012 at 2:51 PM, Ethan Furman wrote:
> Julio Sergio wrote:
>
>> Jose H. Martinez gmail.com> writes:
>>
>>
>>> You should define the function first and then call it.
>>>
>>>
>>> def something(i): r
Julio Sergio wrote:
Jose H. Martinez 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
On 01/-10/-28163 01:59 PM, Julio Sergio wrote:
I know that changing the order of the definitions will work, however there are
situations in which referring to an identifier before it is defined is
necessary, e.g., in crossed recursion.
Mutual recursion isn't a problem: the following strange exp
On Tue, Jun 12, 2012 at 2:33 PM, Julio Sergio wrote:
> Suppose I have to define two functions, aa, and, bb that are designed to call
> each other:
>
> def aa():
> ...
> ... a call of bb() somewhere in the body of aa
> ...
>
> def bb():
> ...
> ... a call of aa() somewhere in
Jose H. Martinez 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 t
On 12/06/2012 18:53, Julio Sergio wrote:
I'm puzzled with the following example, which is intended to be a part of a
module, say "tst.py":
a = something(5)
def something(i):
return i
When I try:
->>> import tst
The interpreter cries out:
Traceback (most recent call last):
On 6/12/2012 10:53 AM Julio Sergio said...
So I modified my module:
global something
a = something(5)
def something(i):
return i
And this was the answer I got from the interpreter:
->>> import tst
Traceback (most recent call last):
File "", line 1, in
File "tst.py
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:
global alias = something
print alias(i)
On Tue, Jun 12, 2012 at 1:53 PM, Julio Sergio wrote:
> I'm puzzled with
I'm puzzled with the following example, which is intended to be a part of a
module, say "tst.py":
a = something(5)
def something(i):
return i
When I try:
->>> import tst
The interpreter cries out:
Traceback (most recent call last):
File "", line 1, in
File "tst.py", line 11
12 matches
Mail list logo