-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
for-elif-else
, try-except-elif-else-finally
& while-elif-else
#17
Comments
@dg-pb, I've actually been thinking about this as well :). I would indeed restrict your proposal to |
I would say that adding |
for-elif-else
and while-elif-else
for-elif-else
, try-except-elif-else-finally
& while-elif-else
Yes, totally missed that: https://docs.python.org/3/reference/compound_stmts.html#the-try-statement |
Which regex were you using to find examples? |
I have mentioned in the PR that I might work on this myself. For now I am introducing the idea, slowly gauging feedback and evaluating if it is needed. If it reaches implementation stage and I decide not to take it myself, I will let you know. |
I was more thinking about a proof of concept, which allows you to discover potential issues and what modifications are necessary. |
I don't think prematurely jumping into implementation is worthwhile.
|
How about allowing statements after else, like in C? try:
except:
else try:
except: |
It is what Chris has identified: https://discuss.python.org/t/while-elif-else-for-elif-else-try-except-elif-else/57208/16
There is no need for second But this is different and orthogonal idea which has nothing to do with current proposal. And this one I would expect would be even more difficult to be accepted than what I am proposing. |
But I might be wrong. It could very well be that community would like it more than my proposal. Maybe someone should propose it just to see what happens. Personally, I have no strong feelings about |
The cool thing about allowing a statement after else, is that it could be any statement; if ...:
pass
else while ...:
pass
if ...:
pass
else pass It might make it easier to get your proposal accepted, to allow simplifying this: while ...:
pass
else if ...:
pass |
How long do you think it would take to implement what I am proposing? And how long do you think it would take to implement what you are proposing? |
I just used python |
This is going nowhere. |
Proposal:
Example:
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
The text was updated successfully, but these errors were encountered: