syntax difference

Ian Kelly ian.g.kelly at gmail.com
Tue Jun 19 16:44:34 EDT 2018


On Tue, Jun 19, 2018 at 1:42 PM Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
>
> On Tuesday, June 19, 2018 at 1:02:52 PM UTC-5, Ian wrote:
> > On Mon, Jun 18, 2018 at 2:57 PM Rick Johnson
> > It's a "burden" (actually, a helpful tool) to the
> > programmer either way: whether it's in a comment or an
> > annotation, it's the programmer's job to keep it correct.
> > Whether it's in a comment or an annotation, it's up to the
> > programmer to read it or not in order to better understand
> > the code. How it would be a burden on the machine either
> > way is beyond me.
>
> If you had read my argument from the beginning of the
> thread, you would have known that: whilst i never liked the
> idea of Python having any kind of type annotations, i made
> it very clear at multiple places in this debate, that i am
> willing to grit my teeth and accept them *IF* the python dev
> team would be kind enough to (1) force all type annotation
> to be declared as comments, or (2) release a tool that will
> remove type-hints (error free) from scripts.

No, that's been perfectly clear. What befuddles me is your continued
insistence that the devs must do this, rather than writing the tool
yourself.

And yes, it would have to be (2), because (1) is obviously out of the
question. The only way to "force" type annotations to be comments
would be to remove the function annotation feature altogether, which
would be hugely backward-incompatible.

> > > After all, it's the Python way.
> >
> > Whatever this platitude is supposed to mean. I don't see
> > "shift the work of programming onto the machine" anywhere
> > in the Zen of Python.
>
> Ian, you an i both know that at our current level of
> technological evolution, we do not yet have machines that
> program themselves. That would require artificial
> intelligence. However, while our machines cannot yet program
> themselves, we certainly can offload many of the _burdens_
> we programmers face onto these machines. And parsing, just
> like computation, is one of those repetitive burdens that
> machines perform far much better than any human ever could.

Type hints are no different in this regard than any other part of the
program. You seem to be under the impression that the less you have to
read, the easier it is. And while that's true to an extent, I'll
remind you that comments, type hints, readable code, all of it are
written primarily for consumption by *humans*, not the machine.

"Programs must be written for people to read, and only incidentally
for machines to execute." - Hal Abelson

> Moreover, Guido has written and has been documented in
> interviews detailing the core principles of Python's design,
> and i dare any of you to find me one quote from those early
> days that gushed about type annotations.

Sorry, I won't be baited by your rhetorical nonsense. Function
annotations are a feature, not a "core principle". You could equally
well ask to find quotes about decorators, or coroutines, or list
comprehensions, or metaclasses, etc. etc.

> > > The beauty of type-hint comments is that even without
> > > striping the type-hint comment from the source code, a
> > > programmer can more easily ignore a type-hint comment than
> > > the interleaved type-hint. This is especially true if the
> > > programmer uses an editor which has syntax hilighting. My
> > > syntax hilighter colors all comments a light gray. So
> > > therefore, i can skip block and blocks of comments in a
> > > fraction of second simply by quickly scanning down to the
> > > first line that is not grayed out.
> >
> > This paragraph was the reason for my statement about "if
> > you're trying to make the case for type hints being treated
> > like comments, this isn't it". If this is not trying to
> > justify why type hints should be in comments (so you can
> > brush them under the rug and pretend they don't exist),
> > then what is it?
>
> Why shouldn't i have the right to "brush type-hints under
> the rug" Ian? After all, if the code *I* write doesn't
> belong to *ME*, well then, who *HELL* does it belong to?

You're deflecting. This goes on for several more angry paragraphs, so
I'm just going to ignore it and skip ahead.

> So with that in mind, i cannot understand why Python wants
> to saddle me with type-hints?

You seem to keep forgetting that they're optional. Even if you inherit
a program that uses them, nobody is forcing you to read them, to run
any sort of type analysis over them, or even to retain them. But just
because you can delete them doesn't make anybody obligated to provide
you with a tool that you can't be bothered to write for yourself.

> But what is even more disturbing, is the hostility that is
> being displayed here when i request a simple tool that will
> remove these offensive type-hints.

WRITE IT YOURSELF.

That's not me being hostile, just direct.

> > And for all your desire to have your opinion heard, you
> > seem awfully eager to dismiss the opinions of those who
> > actually like and want type hints the way they are.
>
> Did you miss the part where i came to the table and made a
> compromise? Yea -- that part -- the part where i compromised
> to accept these type-hints in exchange for a tool that will
> remove them. Hmm. Is that too much to ask? Surely you don't
> believe that diplomacy is a one-sided compromise, do you?

I was actually referring to statements like this:

> But yet, the _programmer_ cannot ignore it. Does that make
> any sense to you, or anyone else with half a brain?

That's the first thing you wrote in your second post in this thread. I
have no doubt I can find more examples but I don't really want to wade
through it.

Sorry, but you can't go around labeling people as stupid for
disagreeing with you, then turn around the next moment and hail
yourself as a pillar of the community just because you "offered a
[completely one-sided] compromise".

You want to know what would actually be productive for the community
and worthy of respect? Write the tool yourself. You claim that this is
what people really want, right? So just sit down and knock it out, and
you'll be a hero of the people.

> > I don't know why you seem to think that this is a
> > negotiation between yourself and the devs. It's not. As far
> > as the devs are concerned, the discussion on the function
> > annotation feature is done.
>
> And still you don't get it! I am willing to accept the
> inclusion of type-hints, just give me a damn tool to remove
> them!

No, you still don't get it: nobody is losing any sleep over whether
you personally accept the inclusion of type-hints or not.

> Besides, isn't it you and chris and steven who claim that i
> am the only person in the whole community who doesn't want
> type-hints?

I've not claimed any such thing.

> PS: Tell your friend Steven that I'm still waiting on the
> nyms of all these supposed "people" of his who have been
> requesting static typing since "day one".

Sorry, I don't know Steven beyond the occasional intersections of our
posts here.



More information about the Python-list mailing list