del behavior

Chris Rebert clp2 at rebertia.com
Wed Jan 7 20:48:06 CET 2009


On Wed, Jan 7, 2009 at 11:39 AM, Eric Snow <esnow at verio.net> wrote:
> I was reading in the documentation about __del__ and have a couple of
> questions.  Here is what I was looking at:
>
> http://docs.python.org/reference/datamodel.html#object.__del__
>
> What is globals referring to in the following text from that reference
> page?

Globals are variables that have toplevel module scope. Basically, any
assignments, function definitions, or class definitions with no
indentation from the left margin will create a global variable. If you
can get at the variable by appending something of the form
"\nSomeIdentifierHere\n" to the module's file, and it's not a built-in
function, then it's a global.

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com



More information about the Python-list mailing list