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 -- python-ideas@python.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://mail.python.org/archives/list/python-ideas@python.org/message/S3GH67Q3PIF75WJUXPL6ZENE7KJNBBKB/ Code of Conduct: http://python.org/psf/codeofconduct/