4 ms·
The only argument PEP 690 has is A) [performance on startup] or B) [when import functions is not used] in main body of the code. For B), easy enough to run one
by bfung 4y ago
The only argument PEP 690 has is A) [performance on startup] or B) [when import functions is not used] in main body of the code.
For B), easy enough to run one of many linters to detect this case and have people write less bad code.
A) is way more subjective and can be fixed in many ways.
With the many more Python coders these days with less coding experience, personal feeling is please stop throwing these production issue causing features in that I have to fix. Glad the PEP is rejected.
Old programmer wisdom is to load all your configs and assumptions as early as possible to eliminate a whole space of problems with your code, making faster and easier to read/reason about later.
- rrdharan 4y agoI’m curious about the other ways to fix startup performance. I’ve seen a moderately sized (~300k LoC) Python CLI project that had a horrendous, anger-inducing startup time until they switched to the lazy import approach basically described/standardized by PEP 690 and the improvement was massive.
- lmeyerov 4y agoB sounds great but too much of the pydata ecosystem breaks here, like `class MyNeuralNet(nn.Module)`
- bfung 4y agoFor sure, pydata ecosystem is one of the worst offenders. Yeah, the libraries make it easy to do that 1 off model -- shove it in production and watch the next 3-6 months be a pagerduty fest for both the model writer and ops/backend people. It doesn't have to be like that though -- look at geohotz's tinygrad library for exampe: well tested, well written, and can do most of the things the bigger ecosystem libraries do.
- lmeyerov 4y agoThe goal of lang features like these is to automate the optimization especially when it is hard to do at scale without it. Scenarios that start with "If only everyone..." are great candidates. Conversely, agreed, it's not THAT hard to convert an individual project, just being unable to handle third-party, so import-shaming some top projects can likely go far. Features that enable framework providers to empower others are great... And none is needed here. It's messy to push through type checking, but doable. Feel like we are reliving when js got a more static module system. A lot of kicking and screaming, and still issues, but a lot of good came out of that.