syntax difference

Jim Lee jlee54 at gmail.com
Mon Jun 18 14:09:58 EDT 2018



On 06/18/2018 10:46 AM, Chris Angelico wrote:
> On Tue, Jun 19, 2018 at 3:34 AM, Jim Lee <jlee54 at gmail.com> wrote:
>>
>> On 06/18/2018 07:03 AM, Steven D'Aprano wrote:
>>> As a human programmer, you surely perform your own ad hoc type checking
>>> when you write and debug code.
>> Of course.  And, I use linting tools and other forms of static type
>> checking.  What I don't like is adding the *syntax* for static type checking
>> to the (dynamically typed) language proper, particularly when the
>> implementations of said language do nothing but ignore it.
> So you have annotations for type information. Tell me: why should
> these annotations be introduced with a hash and ended with a newline?
> What is it about type annotations that requires that they be delimited
> in this way?
Uhhh....because that's mostly the definition of a comment?  Duh!
> What about assertions? Are they comments too? Should we have, for instance:
>
> if x > 0:
>      ...
> elif x < 0:
>      ...
> else:
>      #assert: x == 0
>      ...
>
> or is it better to use an 'assert' statement? After all, they can
> legitimately be ignored by the interpreter.
>
> ChrisA

I'm noticing a pattern here.  Can we stick to the subject at hand?

-Jim



More information about the Python-list mailing list