syntax difference
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Mon Jun 18 07:40:59 EDT 2018
On Sun, 17 Jun 2018 11:10:55 -0700, Rick Johnson wrote:
> Steven D'Aprano wrote:
>> Bart Wrote:
>> > So what's a Type Hint associated with in Python?
>> Since it is a type *hint*, not a type *declaration*, the interpreter
>> can and does ignore it.
>
> But yet, the _programmer_ cannot ignore it.
The programmer can ignore it, just as they can ignore any other form of
documentation. Nobody is stopping you from writing:
result = function(the_string=42.5)
if you wish. Adding a type hint doesn't change that.
>> It makes no change at all to the execution model of the language.
>
> Then why the *HELL* are type-hints an official part of the Python
> language syntax?
Just to annoy you.
--
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson
More information about the Python-list
mailing list