[Python-ideas] Re: Expand the try-expect syntax to support conditional expect block

2022-05-19 Thread Ben Rudiak-Gould
On Wed, May 18, 2022 at 12:24 PM Serhiy Storchaka wrote: > try: > expression block > expect Exception if condition else (): > expression block > That's an interesting idea I haven't seen before, but it doesn't work if the condition you want to test depends on the exception object, whic

[Python-ideas] Re: Expand the try-expect syntax to support conditional expect block

2022-05-19 Thread Steven D'Aprano
On Wed, May 18, 2022 at 10:23:16PM +0300, Serhiy Storchaka wrote: > try: > expression block > expect Exception if condition else (): > expression block Aside from the typo "expect" when it should be `except`, that is a terrible thing to do to the people reading your code :-( -- Steve

[Python-ideas] Re: Expand the try-expect syntax to support conditional expect block

2022-05-19 Thread Serhiy Storchaka
19.05.22 09:45, nadav.mis...@gmail.com пише: Awesome! never seen this syntax used before and the above libraries are not using it. Can you elaborate on the else part ? Why is it needed for the syntax to be correct and could you put any expression in the parenthesis ? https://docs.python.org/