Remix.run Logo
robjwells 14 hours ago

Worst of both worlds is right. I came back to a Python project with a couple of critical but untyped dependencies recently after writing mostly Rust, and to clear up a large number of these (particularly “type is partially unknown”) I had the choice between lots of purely type-checking ceremony (`typing.cast`) or going without.

gizmo385 9 hours ago | parent | next [-]

The third option here is writing type stubs for the library, which you can sometimes find community versions of as well. They’re not too time consuming to write and generally work well enough to bridge the gap

robjwells 7 hours ago | parent [-]

Yeah, I think this may be a good option when actively working on a project. Sadly at the moment, it's mostly a case of "I just need to make a couple of bug fixes in this old project, why is my editor shouting at me?"

rrr_oh_man 13 hours ago | parent | prev [-]

What did you end up choosing & why?

robjwells 12 hours ago | parent [-]

It's only a personal side project and I have a good handle on the untyped modules in question, so in the end I suppressed most of the errors with `# type:ignore` and friends.

I'd reconsider that if I was doing more than the odd bug fix on the project. I still like Python, and started using type hints early, but there's enough added friction to make me question using them in the future.

I imagine on big projects the benefit is clearer.

rrr_oh_man 7 hours ago | parent [-]

Thanks for sharing!

Asking because I was really, really annoyed by the non-helpfulness of the type hints in practice, contrary to the theory.