For me it's really easy given your example without the end statements. I suppose your use case is actually about much longer code, with much more cyclomatic complexity.
I recommend you run McCabe's algorithm instead to help refactor your code. https://pypi.org/project/mccabe/
_______________________________________________ Python-ideas mailing list -- firstname.lastname@example.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://email@example.com/message/S3GH67Q3PIF75WJUXPL6ZENE7KJNBBKB/ Code of Conduct: http://python.org/psf/codeofconduct/