September 15, 2020 4:31 PM, "Gregory P. Smith" <firstname.lastname@example.org (mailto:email@example.com?to=%22Gregory%20P.%20Smithfirstname.lastname@example.org)> wrote: On Tue, Sep 15, 2020 at 1:27 PM <email@example.com (mailto:firstname.lastname@example.org)> wrote: September 15, 2020 4:02 PM, "Daniel Butler" <email@example.com (mailto:firstname.lastname@example.org?to=%22Daniel%20Butler%22%20%3Cdabutler89@gmail.com%3E)> wrote:
Users would be encouraged to try it but
NOT to publish code using it.Thinking out loud, macros could be enabled with a command line flag. Advanced users would know how to use it but others would not. If the macro flag is not enabled it raises a syntax error. Thoughts?
Daniel Butler A command line flag would be slightly better. All the documentation warnings in the world will not be enough to prevent all the cargo culters from creating some of the hardest to read code you ever saw.
If you're talking about a command line flag, I suggest you read the pre-PEP. The proposal requires explicit import-like syntax to bring the macro in for parsing of code in the duration of the scope of that import. Which is actually what you'd want for this kind of thing: explicitly declaring which additional / alternate syntax features you use in the code using it. It is similar from the existing `from __future__ import behavior` system.
-gps That may be, but I dislike the thought that 10 years from now the standard Stack Overflow answer to "how do I do x in Python" will be "use my magic 5000 line macro". A command line flag requires more effort, because you need to continually retype it. In theory, that little bit of extra effort could help to limit macro use to areas where it actually is useful.