Perhaps this is a solution in search of a problem but I recently encountered this situation in one of my projects.
I have an object, foo, which, due to the references it contains, I'd rather not keep around longer than necessary. I use foo to instantiate another object: bar = Bar(foo) bar is free to manipulate foo however it wants and even del it if necessary. However, since the foo name is still around, those resources won't get cleaned up even if bar is done with them. The simple solution is bar = Bar(foo) del foo bar.do_stuff() I think it would be a nice (and, I hope, painless) addition to the Python grammar to have del return a reference to the underlying object. That way, I could simply do bar = Bar(del foo) What do y'all think? Juice not worth the squeeze? Dan
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/YRG4J4R3DDEMIFLROWMGEDBIVPM4ZUQ4/ Code of Conduct: http://python.org/psf/codeofconduct/