18
you are viewing a single comment's thread
view the rest of the comments
[-] qwop@programming.dev 2 points 1 year ago

If it's valid syntax you can technically do pretty much whatever you want at runtime with enough hacks. I know pytest does some pretty crazy stuff to get nicer error messages from asserts (e.g. so it can display the value of a and b for assert a == b)

As soon as it's invalid syntax it becomes harder. You can't parse it into an ast, which I assume is why they used regex.

this post was submitted on 04 Jul 2023
18 points (87.5% liked)

Python

6224 readers
4 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

October 2023

November 2023

PastJuly 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS