← Back to context

Comment by ggregoire

3 years ago

Python doesn't have static typing until you add a library to check your "hints". This is valid in Python 3.10:

    def take_a_string_and_return_a_boolean(x: str) -> bool:
        return x

    take_a_string_and_return_a_boolean("hello world") # => "hello world"
    take_a_string_and_return_a_boolean(1234) # => 1234
    take_a_string_and_return_a_boolean(None) # => None

Yes, no language has static typing until you run a static typechecker; for some languages you don’t notice because it is integrated into the normal compiler, etc.