On Tue, Aug 18, 2020 at 6:01 AM Marco Sulla <marco.sulla.pyt...@gmail.com> wrote: > > On Mon, 17 Aug 2020 at 11:17, Steven D'Aprano <st...@pearwood.info> wrote: > > Did you have a specific question to be answered or are you just hoping > > to get people interested in the proposal? > > It seems I have to repost the proposal I already wrote... > > My proposal is to add a way for third party modules to add custom > keywords. Example: > > from mykeywords import @const > @const a = 1
But why? What is the use-case? > Notice that I choose "@" but I hope another non c-alphanumeric > character will be chosen. > > On Mon, 17 Aug 2020 at 12:46, Chris Angelico <ros...@gmail.com> wrote: > > A proposal that requires syntactic changes [...] > > No syntactic changes are needed. Custom keywords *must* be prefixed > with a non-alphanumeric character (@ for example). > This IS a syntactic change. You're proposing things that currently aren't legal: >>> from mykeywords import @const File "<stdin>", line 1 from mykeywords import @const ^ SyntaxError: invalid syntax A non-syntactic change would be something like this: >>> from math import fft Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'fft' from 'math' (/usr/local/lib/python3.10/lib-dynload/math.cpython-310-x86_64-linux-gnu.so) If you were to propose adding a Fast Fourier Transform function to the math module, that wouldn't require any changes to syntax. If you propose adding a dict.fromvalues method to mirror the fromkeys method, that wouldn't require any changes to syntax. But you're suggesting something that would be syntactically invalid in all previous versions of Python. And you still haven't said why it would be useful. Just "hey look we'd be able to... uhh... do custom keywords". That's not a justification. 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/B3JLVALTJYMSG2E2JE3XPB7H66XUK5KQ/ Code of Conduct: http://python.org/psf/codeofconduct/