On Wed, Dec 1, 2021 at 6:58 PM Steven D'Aprano <st...@pearwood.info> wrote:
>
> On Wed, Dec 01, 2021 at 07:47:49AM -0000, Jeremiah Vivian wrote:
>
> > > 2) Independently: Is the syntactic distinction between "=" and "=>" a
> > > cognitive burden?
> > No, it isn't much of a cognitive burden.
>
> You say that now, but if you read function definitions that looked
> like this:
>
>     def process(func:List->int=>xs=>expression)->int:
>         ...
>
>
> would you still agree?
>

I'm not sure what that's supposed to mean. Is List->int an annotation,
and if so, who's deciding on that syntax? You seem to have used two
different arrows in two different ways:

List->int # presumably an annotation meaning "function that takes
List, returns int"
func:ann=>dflt # late-bound default, completely unnecessary here
xs=>expression # presumably a lambda function
def process(args)->int # return value annotation

Why should List->int and xs=>expression use different arrows? Wouldn't
it be much more reasonable for them to use the same one, whichever
that be? And if that does turn out to be "=>", then yes, I would be
looking at changing PEP 671 to recommend := or =: or something, for
clarity (but still an equals sign with one other symbol next to it).

It's always possible to come up with pathological code. But this is
only really as bad as you describe if it has zero spaces in it.
Otherwise, it's pretty easy to clarify which parts go where:

def process(func: List->int => xs=>expression) -> int:
    ...

Tada, easy grouping.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/SM2LL7OXRBLRSAAES5NUMMORYOGMOR7U/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to