On Tue, Dec 8, 2020 at 10:42 AM David Mertz <me...@gnosis.cx> wrote:

> On Tue, Dec 8, 2020 at 3:31 PM Ricky Teachey <ri...@teachey.org> wrote:
>
>> I agree with the person who called this a brilliant solution. Here is the
>> code from the link for completeness:
>>
>
> I'm not diss'ing the approach.  But it doesn't really save that much over
> a sentinel variable `break_to_middle`.  And if you wanted to break to any
> of several levels from the innermost, you'd need multiple context managers.
>
>
>>
Fair enough. For me the "brilliance" comes in how readable it comes out to
be; I find it far easier to scan through and understand (without even
looking at the brk() function to see what it does) the first time through
then the sentinel approach. My syntax suggestion came from thinking about
how to make it even more readable (providing one can swallow the "this
decorator automatically becomes a context manager" part-- which might be
too hard to swallow I don't know).

---
Ricky.

"I've never met a Kentucky man who wasn't either thinking about going home
or actually going home." - Happy Chandler
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/LAKWE3MDR75OEOC7SBEOWYVTSFMVPGSS/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to