syntax difference

Jim Lee jlee54 at gmail.com
Mon Jun 18 14:55:24 EDT 2018



On 06/18/2018 11:49 AM, Chris Angelico wrote:
> On Tue, Jun 19, 2018 at 4:34 AM, Jim Lee <jlee54 at gmail.com> 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.
>>
> I don't know what you mean by "syntactic meaning". Do you mean that
> they create no executable bytecode, that they have no run-time
> influence? Because that's not entirely true; they are stored, and can
> be viewed at run-time. In fact, in optimized mode, assertions produce
> no bytecode whatsoever; so by that definition, they are more comment-y
> than annotations are. Do you have some other definition?
>
> ChrisA
I'm tired of running around in circles with you, so I will respectfully 
decline to comment further.

-Jim




More information about the Python-list mailing list