4 ms·
Thanks for this I've had this notion in my head, of making variables capable of echoing out their own definition when printed for easier time writing tests/deb
by gavinray 4y ago
Thanks for this
I've had this notion in my head, of making variables capable of echoing out their own definition when printed for easier time writing tests/debugging
Didn't know it had a name
- nerdponx 4y agoIn Python, there is a distinction between the text representation of an object, and the result of converting the object to a string. Classes can implement both methods independently, and it's not uncommon to have a repr method that returns something that you could (at least in theory) evaluate as literal Python code. This is very useful for debugging and logging, although not nearly as cool or powerful as the Lisp equivalent.