Making Python better one error message at a time
2022-07-13 , The Auditorium

Error reporting has been an area that sadly has not improved a lot recently in the Python interpreter and users have been battling with very obscure runtime errors and puzzling syntax error messages that range from very generic (just “syntax error: invalid syntax”) to directly misleading (the error displayed for unclosed parentheses). This situation has frustrated users for a long time and has forced everyone into learning “what the interpreter really wants to say” or “where the error really could be”. This problem is especially acquitted for first-time learners of the language as they can lose a lot of time trying to decipher what the error messages they just got mean and where the problem may be.


Python 3.10 has been recently released and among many exciting new features, one of the biggest improvements is the inclusion of a whole new set of changes focused on improving the error messages across the interpreter and the general user experience when dealing with error messages. The new error messages have been one of the most welcomed features from very different sets of users ranging from Python teachers and educators, first-time learners, industry professionals and data scientists.

In this talk, we will cover:

  • What are the new improvements featured in Python 3.10.
  • Exciting new changes and improvements that will feature in Python 3.11.
  • How these improvements are useful to different sets of users from people learning Python to experienced programmers.
  • How the new PEG parser has unlocked adding new custom syntax errors.
  • How these improvements were implemented and what challenges the CPython core team faced to get them working reliably.
  • How users can contribute to adding new error messages: what is the workflow, how the errors are reviewed by the core team and where to find resources and help.

No matter who you are and what you do with Python, there is an improvement that will probably make you smile.


Expected audience expertise: Domain:

some

Expected audience expertise: Python:

some

Abstract as a tweet:

Do you want to learn about the new and improved error messages in the latest releases of CPython? Let's discover together how these error messages are made using the new PEG parser and all the complexities behind them!

Pablo Galindo Salgado works in the Python Infrastructure team at the Software Infrastructure department at Bloomberg L.P. He is a CPython core developer and a Theoretical Physicist specializing in general relativity and black hole physics. He is currently serving on the Python Steering Council and he is the release manager for Python 3.10 and 3.11. He has also a cat but he does not code.

This speaker also appears in: