Anonymous user
Control Structures: Difference between revisions
→[[Python]]
(→[[Python]]: with-statement) |
|||
Line 485:
bar()
baz()
else:
# break was not called
quux()
===for===
for i in range(10):
print i
else:
===try-except-else===▼
# break was not called
foo()
▲===try-except-finally-else===
'''Interpreter''': Python 2.5
Before Python 2.5 it was not possible to use finally and except together.
try:
Line 496 ⟶ 508:
except TypeError:
bar()
baz()
else:
# no exception occurred
quux()
Line 504 ⟶ 519:
'''Interpreter''': Python 2.5
with foo() as bar:
|