object scope

George Sakkis george.sakkis at gmail.com
Mon Jan 21 00:41:39 EST 2008


On Jan 21, 12:16 am, "J. Peng" <jp... at block.duxieweb.com> wrote:

> Dennis Lee Bieber 写道:
>
> >    The scope of "name" is the entire function; lacking a "global name"
> > statement, AND being on the left side of an assignment, it is a function
> > local name.
>
> Thank you. Does python have so-called 'block scope' object?

No, it doesn't; in most cases that you may care, a name's scope is
either local or global*.

> or if you can,please show me the doc for python's object scope.

http://www.network-theory.co.uk/docs/pytut/PythonScopesandNameSpaces.html


George


* There is also class scope and lexical closures but most likely you
don't have to worry about them for now.



More information about the Python-list mailing list