News for hackers. Stuff that matters.
Re:Python’s “type hints” are a bit of a disappointment to me by icedchai on Thursday April 21, 2022 @07:18PM (#31116371)
Duck typing is really enforcement of interfaces, not types themselves. Everyone who has passed a string into a Python method expecting a list of strings has run into this. It works, but did you really want to process a character at a time?

Also, some languages like Java do actually enforce types at runtime. If you've ever called a Java method dynamically with the wrong types, you'd know. You can run into ClassCastException, or worse (ClassNotFoundException if you have the wrong classloader.) This is a runtime error.

Re:Python’s “type hints” are a bit of a disappointment to me by kadoban on Thursday April 21, 2022 @10:27PM (#31117559)
> Duck typing is really enforcement of interfaces, not types themselves

A type system is just a set of rules that must be followed. The rules can be as weird or as simple as you want. Just because <int> + <string> is allowed doesn't mean it's not enforcing types.

Not really a criticism, just trying to push to expand your idea of what a type system is.