4 ms·
The best Python feature you cannot use
- sametmax 3y agoAnother one you can't use: entry points. In theory, they would be the perfect plugin system, but in practice, they are so slow if all your stack add a couple of them, Python start up takes seconds. And this is why we are all using the .pth hack.
- boothby 3y agoAs a bit of a joke I wrote a library for this once https://github.com/boothby/dissert https://github.com/boothby/dissert The big problem is that some people use assert wrong. There's a distinct time and place for asserts, and that's for testing purely internal logic. If you're testing anything that can be tainted with user data, that must be done with a conditional & exception. Dissert saves the day! You can disable asserts on a per-file basis, and get that PYTHONOPTIMIZE experience with no perceived loss of safety. Of course, it uses the horrid content-encoding hack to trim assertions out of your code, so I make no guarantees.