scoping problems
Rich Harkins
rharkins at thinkronize.com
Fri Jul 27 15:08:01 EDT 2001
In Python this just works - no need for prototypes (the symbols don't bind
inside the function until it is called although the scopes do). For example
try the following on your interactive interpreter:
>>> x=5
>>> def f():
... print x
...
>>> f()
5
>>> x=2
>>> f()
2
>>>
Rich
> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Narayan Desai
> Sent: Friday, July 27, 2001 2:40 PM
> To: python-list at python.org
> Subject: scoping problems
>
>
> How can i define the following code:
>
> def a():
> b()
>
> def b():
> a()
>
> (ignoring for a moment that this would never terminate)
> How do you get the namespaces right?
>
> I would solve this with function prototypes in C, but it isn't clear
> to me how to do this in python.
> thanks...
> -nld
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list