Ethan Furman <[email protected]> added the comment:
My apologies if I missed something, but do we have a consensus on the desired
solution?
My understanding of `try/finally` is that whatever happens in the `finally`
clause should:
- always happen
- win any conflicts with `try` clause
For example:
try:
a = 2
finally:
a = 3
print(a)
# 3
and
def f():
try:
return 5
finally:
return 7
print(f())
# 7
So it seems like the ideal solution to:
def mult(thing):
print(thing*2)
return thing * 2
def simple():
for number in range(2):
try:
return mult(number)
finally:
continue
print(simple())
would be:
0
2
None
----------
nosy: +ethan.furman
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37830>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com