Re:Writing Python Like Rust
by scubbo on Wednesday June 28, 2023 @11:57PM
(#36516151)
AFAIK, you only need to import the actual types that you're using (`from typing import List, Iterable, Optional, ...`). What else is there?
[ Parent
| on HN ]
In newer Python versions, you don't need most of those imports either:
foo: list[str] = ["a"]
bar: int | None = 1Yeah, but that's completely unnecessary friction.
Granted - but the original claim was that "it feels weird that so many tools get hidden inside libraries", and I'm asking for an example of more than one of these "so many".
Re:Writing Python Like Rust
by abdullahkhalids on Thursday June 29, 2023 @12:50AM
(#36516419)
But why do we have to import any? They should be part of the core language by now. The lack of boldness of Python core developers is sometimes very annoying.
Most of it is part of the core language now.
Re:Writing Python Like Rust
by CameronNemo on Thursday June 29, 2023 @12:14PM
(#36522459)
Yep the only one I've found myself importing as of late is Any.