News for hackers. Stuff that matters.
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?
Re:Writing Python Like Rust by bbkane on Thursday June 29, 2023 @12:18AM (#36516248)
In newer Python versions, you don't need most of those imports either:

  foo: list[str] = ["a"]
  bar: int | None = 1
Re:Writing Python Like Rust by saulpw on Thursday June 29, 2023 @12:47AM (#36516398)
Yeah, but that's completely unnecessary friction.
Re:Writing Python Like Rust by scubbo on Thursday June 29, 2023 @10:46PM (#36529927)
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.
Re:Writing Python Like Rust by verbatim on Thursday June 29, 2023 @10:55AM (#36521253)
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.