On Thu, Nov 12, 2020 at 4:25 PM Greg Ewing <greg.ew...@canterbury.ac.nz>
wrote:

> On 13/11/20 8:21 am, Paul Sokolovsky wrote:
> > The current stage is to accept
> > the fact that "mark capturing terms" is *very viable* alternative to
> > "mark terms to use as values" ... But people
> > behind PEPs keep ignoring that choice - silently, or with minimal
> > consideration/commentary.
>
> Their stated justification for this is that capturing will be
> used much more often than value matching. I'm not convinced about
> that -- how do they know? This is a feature unlike anything
> Python has had before. I don't think we can predict how people
> will use it.
>

Not too differently from how it's used in other languages that have it.


> Even if it's true, this seems to be prioritising writability
> over readability.
>

No, that was never on our mind.


> Marking the captures would be my preferred choice. I don't like
> the idea of DWIM heuristics for distinguishing values from
> captures, I'd prefer everything to be explicit. And it seems
> more logical to me to mark the captures rather than the values.
>
> The vast majority of expressions in Python are interpreted as
> values, and assignment targets only occur in a few specially
> marked places -- on the LHS of an assignment, after "as", etc.
> I think the same principle should apply in match statements.
>

Not so few; there are many syntactic positions representing assignments or
definitions. If you're looking for "what is x" you have to look at all of
them, including def/class, parameters, import without 'as', for.

>
> The only real disadvantage I can see is that it would make
> pattern matching substantially different from unpacking, but
> it's been stated that making these compatible is a non-goal,
> maybe even an anti-goal, and I'm fine with that.
>

We don't want to make them identical (because we can't, really), but we do
like that they are pretty similar, since it will smooth learning (things
don't have to be equal for learning by similarity to happen). This kind of
syntactic "rhyme" is pretty important to me. Marking captures with sigils
would destroy this.

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EWX3GWNTVA6DJMTGT3GG67DOSGDD4L52/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to