On Mon, 18 Jun 2018 11:34:40 -0700, Jim Lee wrote: > On 06/18/2018 11:18 AM, Chris Angelico wrote: >> What, fundamentally, is the difference between type hints and >> assertions, such that - in >> your view - one gets syntax and the other is just comments? > Type hints are just that - hints. They have no syntactic meaning to the > parser, and do not affect the execution path in any way. Therefore, they > are effectively and actually comments. The way they have been > implemented, though, causes noise to be interspersed with live code and, > as others have said, are difficult to remove or ignore.
So let me get this straight... Using annotations is evil, because it intersperses noise with live code: def function(argument: int, flag: bool, sequence: list) -> str: ... But using comments is great, because it doesn't: def function(argument, # type=int, flag, # type=bool, sequence, # type=list): # type=str ... Okay, I'm glad we cleared that up. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list