-
Notifications
You must be signed in to change notification settings - Fork 59
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
fix try-else blocks. #26
Conversation
How does this handle (Otherwise 👍 this looks great. Thanks for catching these) |
tryfinally parses fine without explicit support. It does weird things in global scope though because the try and anything in the finally are viewed as separate constructs, but most things in global scope are weird currently. IMO that's a separate bug, which I'm working on separately. |
... should the tryelse clause actually add to the complexity? I don't think it's linearly independant from the main try clause. In other words, because it's only ever run if none of the except clauses are run, and always after the code in the main clause, it doesn't seem to provide a separate line of execution from any of the other clauses. |
I think it should add to the complexity. Here's my reasoning: Either
|
Actually now that I think of a more complex example def f():
try:
function_one(1)
function_two(arg)
except TypeA:
print(2)
except TypeB:
print(3)
else:
print(4)
finally:
if x:
print(5.1)
else:
print(5.2) I see that actually you could branch to any of the except clauses from either of the statements in the
|
Your graphs don't support your assertion that the 'else' should add to the --phone is hard.
|
At any rate, I think we've opened two separate issues:
I think those issues can be handled separately, and the patch at hand is a strict improvement over master. |
Any blockers? |
Sorry @bukzor no. I don't think there are any blockers. I'm just going to review this once more before merging. |
No worries. |
closes #24 and #25
Minus seven lines and two bugs.