On Wed, Jul 31, 2019 at 2:06 AM Rob Cliffe via Python-ideas <python-ideas@python.org> wrote:


On 31/07/2019 00:35:59, Eric V. Smith wrote:
>> On Jul 30, 2019, at 11:38 AM, Guido van Rossum <guido@python.org> wrote:
>>
> ..
>
>>       with connect() as stream:  # connect() or __enter__() can fail.
>>           for data in stream:  # __next__() can fail
>>               write(data)  # write() can fail
>>   
>> This very much looks like toy networking code to me
Because Serhiy presented his idea in just about the simplest, clearest
possible example, rather than something more complicated which a lot of
people might not bother to read.
(Don't get me wrong - I'm not definitely convinced this proposal should
be implemented.  I just don't want its merits to be overlooked.)

Serhiy presented the *technical* problem very clearly indeed. But comparing this toy example to the expanded version and saying "look how bad it is, this must be solved with new syntax" is attacking a strawman.

We're now stuck with a proposed syntax change that is likely to cause confusion and broken code, and we have to judge how bad the original problem really is, and if there aren't other work-arounds for it. Searches for other syntactic solutions have been unsuccessful.

The approach of defining separate exception types appears to be the best solution that doesn't require new syntax, so let's consider this solved.

--
--Guido van Rossum (python.org/~guido)
Pronouns: he/him/his (why is my pronoun here?)