On Mon, 17 Aug 2020 at 22:10, Guido van Rossum <gu...@python.org> wrote:
>
> Please try to learn how to write a good proposal. A few examples, like you 
> did here, just isn't enough. It's worth doing right, and it's worth 
> *learning* how to do it right.

Well, I'll try.

In pure python, you can change everything. It seems that the only
things you can't really modify are the keywords. And this is for
obvious reasons, since if you change the keywords, the code will be
absolutely unreadable.

We could add a way to define new keywords using a third-party module;
but what if the keyword is already presented as variable, class,
function etc. name?

So my idea is that these custom keywords must start with a
non-alphanumeric character (and underscore). For now, I'll call this
char "@"

For example, many py programmers desider to make their objects a
constant. This could be done in the example I wrote before:

from mykeywords import @const
@const a = 1

The new `@const` will be added as a hook to the PEG parser. if the PEG
parser finds a `@const`, it will invoke the miniparser of `mykeywords`
module inherent to `@const`. In this case, it will simply transform
`@const a = 1` in `const PyObject* a = PyLong_FromSsize_t((Py_ssize_t)
1)`

A problem is that, since `a` now is const, it can't be reassigned. I'm
not an expert about parsers, so I ask for info.
_______________________________________________
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/UI65FU6A246H3ZOWWAOFZOVSTMQBHRXE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to