Strange variable scope... is this right?

Fredrik Lundh fredrik at effbot.org
Sat Jan 13 11:09:16 EST 2001


gradha at iname.com wrote:
> I expected python to bark at me like C would, but from what I read in the
> tutorials, this seems to be one of those variable scope issues, right?

Nope.  All f's represent the same variable, but it points
to different objects at different places in your program.

Don't have time for a detailed explanation, but I suggest
you spend a little time reading up on how names, objects,
and assignments really work in Python.  Start here:

    http://effbot.org/guides/python-objects.htm

and then read

    http://www.python.org/doc/current/ref/objects.html
    http://www.python.org/doc/current/ref/execframes.html
    http://www.python.org/doc/current/ref/assignment.html

Gotta run /F





More information about the Python-list mailing list