News for hackers. Stuff that matters.
Re:Writing Python Like Rust by tnecniv on Wednesday June 28, 2023 @10:59PM (#36515819)
This was something that was in vogue in the mid / late 2000s, then Haskell became the cool kid language and types are back.

The thing that drives me crazy about Python typing is that I need to import stuff to make full use of the type system. Like I get that the typing is option because that would be a huge language overhaul, but it feels weird that so many tools get hidden inside libraries (standing or otherwise).

Re:Writing Python Like Rust by stuntkite on Wednesday June 28, 2023 @11:31PM (#36515995)
This is sort of a derailment of the convo, but I'll try to bring it home. I think it's relevant.

I'm about to turn 40. I've been selling software services to survive since I was 15. Started with PHP and Perl. Started with slanging the services of my friends who were better programmers than I but couldn't deliver on time still. I've always known I'm not a great programmer, but I've got grit and I glue stuff together well. I'm very comfortable in multiple languages but python is my go to. Rust has been fun. I can really feel lately that not only was I never very good but I will never be a better programmer than I was in say 2018ish. Dialogues like this here confirm that form me. I'm aware of python types. I don't care. It is so freaking rare that any job actually requires real programming. I've been everywhere man and there are so few environments that actually reward knowledge like this. However, folks that know it.... like really know it. Smarter or more studious people than I that can really have an opinion and fold it like origami.

I think what I'm trying to say here is that I don't care about the language anymore I care about environmental consistency and being able to see the action of what I assemble painted on a screen or in robotic motion with as few barriers as possible. When you start to get into distributed multi-cloud/multi-cluster to edge man... I don't know. I think I'm just trying to speak up for those of us who operate at a different Field of View because the time and support and payout to really get into the the good stuff just never materialized.

I do think convos like this will be moot in the next year or so though. Not that you can't have your preferred and dig deep but WebGPU and distributed compute shaders and... blah blah blah... Training a model on my GPUs to build me a bootloader from scratch on x86 eh? Tear down all the window dressing and this is like talking about different brands of cigarettes or flavors of piss.

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.