Design thought for callbacks
Marko Rauhamaa
marko at pacujo.net
Sun Feb 22 02:52:24 EST 2015
Steven D'Aprano <steve+comp.lang.python at pearwood.info>:
> Marko Rauhamaa wrote:
>> Grant Edwards <invalid at invalid.invalid>:
>>> the polite thing to do is to delete references to it when you're done
>>> with it.
>>
>> I disagree with that recommendation. You should do the natural thing and
>> not care who holds references to who.
>
> I don't understand this. What is "the natural thing" if not to delete
> references to an object when you are done with it? Normally you just let
> things go out of scope, but if that won't happen, you have to take active
> steps, such as calling del or setting the reference to None.
Obviously, if you are hoarding objects in a collection, you're going to
land in trouble.
What I mean, though, is that you shouldn't think you need to create
object destructors where you routinely set all members to None.
Marko
More information about the Python-list
mailing list