Lee-W commented on PR #34108: URL: https://github.com/apache/airflow/pull/34108#issuecomment-1709599113
> > Same as #34113. I'm wondering why we want to consolidate imports this way. Does that mean we should avoid `from ... import ...` pattern. > > I'm suggesting having all imported modules/classes the same way, so in this case there's always `import random` and not `from random import random` which could confuse devs. `random` is a case where direct `import random` is better, since solitary `random()` or `randrange()` may be obvious, but `sample()` or `choice()` not. > > There are cases where I do `from … import …`, e.g. `collections` or `pathlib`. The most important rule is to be repo-wide-consistent. I also usually do `import itertools as it`, but the maintainers suggested to keep it as `itertools`, which I do not object. Yep, agree unifying them would be great 👍 Do we want to document it somewhere? (e.g., use `import random` instead of `from random import random`) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
