deleting a parameter's name as it is passed to a function

Steven D'Aprano steve at REMOVETHIScyber.com.au
Fri Oct 14 23:44:40 EDT 2005


On Fri, 14 Oct 2005 17:40:48 -0700, Amir  Michail wrote:

> Hi,
> 
> I think it would be useful to delete a name of a parameter object as
> the object is passed to a function:
> 
> dosomestuff(del a)

That's a horrible syntax. It would require Python to be completely
re-designed to allow statements where expressions are allowed, and it
isn't even clear what your syntax means. It looks like it means "delete
object a, and then call dosomestuff on the result returned by del".


> instead of
> 
> dosomestuff(a)
> del a

That is lovely and clear.

> The idea is to garbage collect the object as soon as possible, and this
> may be sooner than when dosomestuff returns.

What difference does that make? Why do you care when object a is garbage
collected?


-- 
Steven.




More information about the Python-list mailing list