27 Mar
2009
27 Mar
'09
11:08 a.m.
Nick Coghlan wrote:
As you say, it does make it easier to write a non-generator delegation target, since implementing close() for finalisation means not having to deal with the vagaries of correctly reraising exceptions.
It also means that existing things with a close method, such as files, can be used without change. Having a close method is a fairly well-established way to make an iterator explicitly finalizable, whereas having a throw method isn't. -- Greg