News for hackers. Stuff that matters.
Re:Python’s “type hints” are a bit of a disappointment to me by theodorejb on Thursday April 21, 2022 @06:19PM (#31115876)
> 1. If you're using a dynamic language, then _by definition_ the language will not enforce your static hints at runtime.

Counterexample: PHP is a dynamic language which enforces static type declarations at runtime.

Re:Python’s “type hints” are a bit of a disappointment to me by dgb23 on Friday April 22, 2022 @02:05AM (#31118711)
Fun fact: it will still do type coercion in that scenario without strict mode. And you cannot annotate assignments. Otherwise it’s pretty useful.
Re:Python’s “type hints” are a bit of a disappointment to me by ledauphin on Thursday April 21, 2022 @06:40PM (#31116063)
Meh. you can do the same thing in Python if you really want - there are dynamic interpreter shims that can do this.

The point is that it is not expected by definition, since by definition, static != runtime.

Re:Python’s “type hints” are a bit of a disappointment to me by lolinder on Thursday April 21, 2022 @07:29PM (#31116443)
You're assuming that type hints are by definition static-only. There's no particular reason why type hints can't be both statically and dynamically enforceable, as they are in PHP.