Mark Dickinson <[email protected]> added the comment:
For extra fun, you can add `break` and `continue` paths into the mix to get a
5-fold instead of 3-fold code size increase per level of nesting. It's still
contrived code, though.
Example where do_cleanup() ends up with 5**4 = 625 paths:
----
def f():
while True:
try:
if something(): break
elif something_else(): continue
elif yet_something_else(): return
finally:
try:
if something(): break
elif something_else(): continue
elif yet_something_else(): return
finally:
try:
if something(): break
elif something_else(): continue
elif yet_something_else(): return
finally:
try:
if something(): break
elif something_else(): continue
elif yet_something_else(): return
finally:
do_cleanup()
----
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42873>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com