3 ms·
> that won't move imports in ways that potentially change behavior of the codebase How can that be the case? Can't Python imports have behaviour that varies on
by chrisseaton 5y ago
> that won't move imports in ways that potentially change behavior of the codebase
How can that be the case? Can't Python imports have behaviour that varies on the time of the day if they want?
An import could monkey patch a basic operation one day but not the next.
- jreese 5y agoAbsolutely! We're hoping that the vast majority of modules are good citizens, but we also know that the reality not perfect. That's why µsort allows you to configure a list of modules with known import-time side effects, and µsort will then treat those are barriers everywhere. https://usort.readthedocs.io/en/stable/guide.html#side-effect-imports https://usort.readthedocs.io/en/stable/guide.html#side-effec...
- stefan_ 5y agoEven better, you can overwrite the default importer to substitute your own with any behavior you want. Used in EVE Online to do their "hide the python code somewhere" scheme.