mojo icon indicating copy to clipboard operation
mojo copied to clipboard

[mojo-stdlib] Import what you use rather than `from <module> import *`

Open JoeLoser opened this issue 10 months ago • 3 comments

Review Mojo's priorities

What is your request?

In general, wildcard imports aren't great for a variety of reasons. In our style guide we mention to avoid import *. So, it would be nice to audit (and fix) where we still use import * in the source code of the standard library and replace it with explicit imports of the entities (functions, aliases, etc.) used in that file.

What is your motivation for this change?

Adhere to style guide.

Any other details?

Related to https://github.com/modularml/mojo/issues/2023, recommend we do https://github.com/modularml/mojo/issues/2023 first to avoid conflicts.

Should we make a special case for from testing import * in test files? By definition, since test files are "leafs" in a build target graph, we won't leak symbols downward, for example.

JoeLoser avatar Mar 28 '24 23:03 JoeLoser