deleting a parameter's name as it is passed to a function
Paul Rubin
http
Fri Oct 14 23:37:24 EDT 2005
"Amir Michail" <amichail at gmail.com> writes:
> But dosomestuff can get rid of its reference before it returns (perhaps
> it has a lot more to do before it returns and so you would want to
> garbage collect the parameter object as soon as possible).
That would be so rare and weird that your best bet is to just pass a
boxed object in the odd circumstances where it will make any
difference. Instead of dosomestuff(x), say dosomestuff([x]). Then
dosomestuff can mutate the list:
def dosomestuff(xl):
x = xl.pop()
... do stuff with x ...
x = None # free the reference
... more stuff...
More information about the Python-list
mailing list