execfile question

Steven Majewski sdm7g at Virginia.EDU
Tue Feb 19 16:43:03 EST 2002


On Tue, 19 Feb 2002, Kerim Borchaev wrote:
> And can you explain who holds a reference on C instance in my example
> when 'execfile' completes?

Python 2.2 (#36, Jan 30 2002, 17:50:25)
[GCC 2.95.2 19991024 (release)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print execfile.__doc__
execfile(filename[, globals[, locals]])

Read and execute a Python script from a file.
The globals and locals are dictionaries, defaulting to the current
globals and locals.  If only globals is given, locals defaults to it.

>>> execfile( 'executable.py' )
it's me
init
>>> dir()
['C', '__builtins__', '__doc__', '__name__', 'c']
>>> del c
deleted
>>>

-- Steve Majewski


> ----------------------------------
> My original question:
>
> > Can someone explain why while running this script I don't see C.__del__
> > eventually called?
> >
> > For me the output of it's execution is:
> >
> > >main.py
> > it's me
> > init
> > executed
> > >
> >







More information about the Python-list mailing list