Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Detect broken __slots__ in Python libraries (github.com/ariebovenberg)
2 points by ariebovenberg on Jan 4, 2022 | hide | past | favorite | 1 comment


__slots__ is a good way to make Python classes more efficient. There is a catch though: you need to use it consistently in all base classes, or you don't get the full benefits. This is easy to forget, and there's nothing warning you if you mess up!

After fixing this in the `returns` library, I decided to create a tool `slotscheck` to detect this common problem anywhere.

I ended up finding broken slots in popular libraries, and even the stdlib. (see my blog post for the findings: https://dev.arie.bovenberg.net/blog/finding-broken-slots-in-...)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: