
Statements was managed by complicated bytecodes with context-dependent semantics. Until recently flow control within the try- finally and with Operations that could, and should, have been done in the compiler. Those bytecodes have often had their own internal flow-control, performing Of the AST into new, complex bytecode instructions. Historically, new language features have been implemented by naive compilation Long term stability for the bytecode interpreter It is nearly impossible to make sure that a new feature is completely reliableīefore it is released bugs relating to the with and yield fromįeatures were still being fixed many years after they were released. Yield from expression to have been trialed.ĭoing so might well have lead to a higher quality implementationĪt first release, by allowing more testingīefore those features were included in the language. It is possible to demonstrate potential language extensions using macros.įor example, macros would have enabled the with statement and Macros can express those patterns in a more concise and less error-prone way. Many domains see repeated patterns that are difficult or impossible Improving the expressiveness of libraries for specific domains That suits their domain or programming style.

Language compact and fitting their brains, and those wanting a new feature There will be a constant battle between those wanting to keep the Without some form of user-defined language extensions, We need to let the community develop their own extensions. Language extension for machine learning is worthwhile.īy allowing language extensions to be modular and distributable, like libraries,ĭomain-specific extensions can be implemented without negatively impactingĪ web developer is likely to want a very different set of extensions from This makes it extremely difficult for the core developers to determine whether a However, most of the core developers of Python do not have a background in The use of Python in data science and machine learning has grown very rapidly Some users, regardless of how many users, or how beneficial that feature would It is very difficult or impossible to add a feature that would benefit only Python was once described as Python Fits Your Brain,īut that becomes less and less true as more and more features are added.īecause of the high cost of adding a new feature, Harder to learn and harder to understand. Each new feature makes the language larger, Python is now sufficiently powerful and complex, that many proposed additionsĪre a net loss for the language due to the additional complexity.Īlthough a language change may make certain patterns easy to express, New language features can be controversial, disruptive and sometimes divisive. Providing the ability to extend the language for specific domains withoutĪdding to complexity to the language as a whole. Syntactic macros allow libraries to modify the abstract syntax tree during compilation, With text-based substitution macros, and allows the implementation


This reduces the chance of mistranslation that can happen The term “syntactic” means that this sort of macro operates on the program’s

This PEP adds support for syntactic macros to Python.Ī macro is a compile-time function that transformsĪ part of the program to allow functionality that cannot beĮxpressed cleanly in normal library code.
