Hi,
The scenario is this:
A generator, G, has a non-generator sub-iterator, S,
(ie G includes a "yield from S" experssion and S is not a generator)
and either G.close() or G.throw(GeneratorExit) is called.
In the current implementation, S.close() is called and,
if that call raises an exception, then that exception is suppressed.
Should close() be called at all? I know that it helps non-generators
to support the protocol, but there is the problem of iterables that
happen to have a close method. This may cause unwanted side effects.
Why is the exception suppressed?
The text of the PEP seems to implicitly assume that all sub-iterators
will be generators, so it is not clear on the above points.
Cheers,
Mark.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com