del
Daniel Silva
dsilva at ccs.neu.edu
Fri Feb 14 19:10:08 EST 2003
Jp Calderone <exarkun at intarweb.us> wrote:
> >>> class Foo:
> ... def __init__(self): self.bar = 10
> ...
> >>> f = Foo()
> >>> del f.bar
> >>> f.bar # AttributeError
Why would you do that? You just broke your class's contract.
> The vast majority of other cases (at least in my code) is for cleaning
> up temporary variables, simply for the sake of namespace cleanliness.
So, usually at the end of modules to make sure only certain things are
provided? The garbage is usually hidden in some scoping anyway...
- Daniel
More information about the Python-list
mailing list