Python gets a "Developer-in-Residence"
Python gets a "Developer-in-Residence"
Posted Jul 29, 2021 19:14 UTC (Thu) by NYKevin (subscriber, #129325)In reply to: Python gets a "Developer-in-Residence" by hynek
Parent article: Python gets a "Developer-in-Residence"
AIUI, this is a deliberate choice on the part of Black, because imports can have side effects.
(Imports *should not* have side effects. You should be able to reorder them without breaking anything. But bad code exists, so...)
Posted Jul 30, 2021 7:37 UTC (Fri)
by hynek (subscriber, #55397)
[Link] (1 responses)
Since PEP 8 asks you to sort your import into blocks of standard library, 3rd party packages, and app packages, a non-trivial insight into the packaging situation of the current app/package is required. Thus it makes sense to punt on it, since it would open a completely new can of worms and the code is already present in isort.
Posted Jul 31, 2021 21:57 UTC (Sat)
by NYKevin (subscriber, #129325)
[Link]
(As mentioned before, there is no good reason for import-reordering to change runtime behavior. It's just that Python doesn't have any hard limits which prevent you from shooting yourself in the foot like that.)
[1]: https://black.readthedocs.io/en/stable/the_black_code_sty...
Python gets a "Developer-in-Residence"
Python gets a "Developer-in-Residence"