SUMMARY
This post asks for some examples that will improve PEP 637, by providing
examples where the existing language specification is not adequate (but PEP
637 is). The rest of this post should tell you why I want these examples,
and what they should look like.

DISCLAIMER
I'm an editor of PEP 637, writing in my personal capacity. And I'm also the
author of package kwkey mentioned below.

SUMMARY
PEP 637 adds to Python's syntax and semantics. It adds statements such as
   >>> x[1, 2, a=3, b=4] = val
to the syntax, and adds new associated semantics.
https://www.python.org/dev/peps/pep-0637/

PEP 1, which defines the PEP process, states that any PEP that changes the
existing language specification should clearly explain "why the existing
language specification is inadequate to address the problem that the PEP
solves".
https://www.python.org/dev/peps/pep-0001/#what-belongs-in-a-successful-pep

As part of addressing this question of existing Python being adequate, I
wrote a new package kwey. This package provides, I believe, a class B such
that
    >>> B(1, 2, a=3, b=4)[x] = val
is equivalent to
    >>> x[1, 2, a=3, b=4] = val
once PEP 637 is implemented. (And if not, please report a bug, and if you
can provide a patch.)
https://pypi.org/project/kwkey/

GOAL
The current version of PEP 637 doesn't mention kwkey. I'd particularly like
us to look for problems where using kwkey as above is not adequate but PEP
637 is adequate.

Aside. Please treat this as a semantic problem, or in other words assume
that
    >>> x[SOMETHING]
    >>> f(SOMETHING)
impose the same constraint on a well-formed expression SOMETHING.

Here's why. PEP 637 allows syntax such as
    >>> x[1:2, 3:4, a=5:6, b=7:8]
and even after PEP 637 (as it currently is)
    >>> f(1:2, 3:4, a=5:6, b=7:8)
is forbidden syntax. But PEP 637 is much more than a syntax extension.

Recall that we already have literal expressions such as
    >>> [1, 2, 3] # List literal
    >>> (1, 2, 3) # Tuple literal
    >>> {1, 2, 3} # Set literal
in Python. If current Python turns out to have adequate semantics, then
perhaps adding
    >>> (1:2:3) # Slice literal
might by itself be enough. This is why I want particularly semantics
examples. They're worth more.

CONCLUSION
I'd like to see semantic examples of problems that can be adequately solved
by PEP 637, but not by using kwkey. The PEP process says, in so many words,
that such examples should be provided.

-- 
Jonathan
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/CZPTQAC666MUBCJNCFEIRA2KJ7MGNEDT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to