Strange behavior of 'del' command..

Kim Jeong Ju haje01 at netsgo.com
Sun Feb 27 14:03:19 EST 2000


Hi.
I am novice in Python programming who need in help. ( again.. )

I am currently into embedding & extending Python to my C++ project.
And I found some strange behavior of 'del' command.

It's about deleting Python object which was instantiated from wrapped
C++ class.

For example, let's say 'my_object' is a instance of wrapped C++ class.

>>del my_object

This works just fine. It exactly calls the destructor of C++ class and frees
memory blocks as it supposed to do.

And here is the weird one

>>exec( 'del my_object ' )

The destructor should be called like above one. But It didn't..
Still the symbol name was deleted.

>>my_object
Traceback( innermost last ):
..
Name error: my_object

Isn't it strange? If you got an idea what happend, please let me know
about it.

Thanks in advance..

Kim Jeong Ju.
haje01 at netsgo.com
http://myhome.netsgo.com/haje01






More information about the Python-list mailing list