03.06.22 21:43, Nadav Misgav пише:
should I try to implement this? seems there is some acceptance
No core developer supported this feature.
My example shows that there is a problem with the proposed syntax. It is
too similar to the existing valid syntax, it will confuse both people
and the c
On Fri, Jun 03, 2022 at 06:43:59PM -, Nadav Misgav wrote:
> should I try to implement this? seems there is some acceptance
If you want to experiment with an implementation just for your own
pleasure, then go ahead. Or if you think that the implementation is
trivial and simple, and a working
should I try to implement this? seems there is some acceptance
___
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 a
I believe this would make the code more legible. Serhiy's take is very
confusing to me (I get it, but don't think one should write like to get this
behavior).
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to pytho
You probably already saw the syntax but it is not common in the "except"
part:
For example, the following:
catch_everything = True
try:
raise Exception()
except Exception if catch_everything else ():
print("Caught!")
It is the same as:
catch_everything = True
exception_to_catch = Excepti
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
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
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/
It's Python's conditional expression, `expression_true if condition else
expression_false`. It's the same thing as C's ternary: `condition ?
expression_true : expression_false`
Also yes, you could put any expression in the parentheses. Just that the empty
one is actually just an empty tuple.
___
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 ?
___
Python-ideas mailing list
18.05.22 22:08, Nadav Misgav пише:
I was thinking of a way to expand the current try-expect block to
support condinitial expect block. I was imagining the new syntax as
try:
expression block
expect Exception if condition
expression block
where the expect expression block would only r
11 matches
Mail list logo