Python 2.0

Hisao Suzuki suzuki611 at okisoft.co.jp
Wed Jun 2 21:08:42 EDT 1999


In article <7j45iv$908$4 at cronkite.cc.uga.edu>,
graham at sloth.math.uga.edu (Graham Matthews) wrote:
> You also seem to believe that with GC finalisation will disappear. Why
> do you believe that (a lot of GC schemes have finalisation). 

You might misunderstand Donn's saying.  As far as I understand,
he says that explicit finalization (or close call, in your
wording) disappears if reference counting is used; finalization
will be done implicitly with destructor such as __del__(self)
all at the expected time then.

> Finally I
> believe you are mis-using finalisation if you use it to close up files,
> sockets, etc. That's what close calls are for.

You are all right in some other languages.  However, if we adopt
such a manner as Pythonic style, we would have to write the code
like this:

	a = SomeClass(....)
	try:
	    ...do something with a...
	finally:
	    a.close()

instead of providing the __del__ method for SomeClass once and
for all.

--===-----========------------- Sana esprimo naskas sanan ideon.
SUZUKI Hisao            suzuki611 at okisoft.co.jp, suzuki at acm.org.




More information about the Python-list mailing list