# An analysis of return-in-finally in the wild

**URL:** <https://discuss.python.org/t/an-analysis-of-return-in-finally-in-the-wild/70633>\
**Category:** Core Development\
**Created:** [November 9, 2024, 10:47am UTC](https://discuss.python.org/t/an-analysis-of-return-in-finally-in-the-wild/70633 "2024-11-09T10:47:24Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![iritkatriel](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/iritkatriel/32/2615_2.png) [@iritkatriel](https://discuss.python.org/u/iritkatriel)\
**Post date:** [November 12, 2024, 2:02pm UTC](https://discuss.python.org/t/an-analysis-of-return-in-finally-in-the-wild/70633/15 "2024-11-12T14:02:11Z")

</div>

> [@guido](#):
>
> I do agree that maybe doing the same (hopefully mostly automated) analysis on a similar amount of _random_ GitHub repos using Python would be nice to confirm what the “average” Python coder does.

I wrote a script to select 20K random packages from [@sethmlarson’s db](https://github.com/sethmlarson/pypi-data/releases), download them and analyse.

There were in total 77,398,892 lines of code with 316 instances of return/break/continue in finally. So about 4 per million lines of code.

I also got this comment on twitter, which seems relevant:

> <https://x.com/_qatoqat/status/1855479191795544474>

---

_[View the full topic](https://discuss.python.org/t/an-analysis-of-return-in-finally-in-the-wild/70633)._
