News for hackers. Stuff that matters.
Re:The best Python feature you cannot use by sametmax on Saturday June 17, 2023 @08:26AM (#36369633)
Another 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.

Re:The best Python feature you cannot use by boothby on Saturday June 17, 2023 @04:00PM (#36373987)
As a bit of a joke I wrote a library for this once

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.