Just thinking about how nice it is in Rust that you can write
std::fs::metadata(&path)?
to reference a function in another module without a use
statement to bring it into this namespace.
Edit: I described below why this is nice: you can use it in the middle of coding something without either stopping to add an import or adding a mental to-do to do so.
The use statement would look like
use std::fs::metadata;
metadata(&path)
which is similar in behaviour to Python’s import
.
The ::
syntax isn’t available in Python because name[start::step]
already has a meaning.
What about import x.y
as an expression?
for x in (import itertools).chain(xs, ys, vz):
...
It is almost always itertools where I want this, or contextlib or collections or some other helper.
As a bonus, this would promote the use of lazy imports which sometimes make programs start faster (I used to avoid these they would ImportError later than they could; these days I’m sad about the cost of imports that are often not used).