Keep a running tally of time spent stringifying. If it passes 1000 msec over the entire life of the program, disable the feature.
As for length, maybe 100 chars? I think that's around what repr() often uses.
As for length, maybe 100 chars? I think that's around what repr() often uses.
I think Python exceptions are verbose enough, not necessary to make it more verbose, more complicated.
Do they matter in reality? No.
Make it an optional feature to be toggled with an interpreter flag. People like me can turn it on, you can keep it turned off.
I think it's pretty important that you shouldn't add features with unpredictable behaviour into the core of the language, particularly into error handling code.
Why would your code contain repr()-functions that trigger "unpredictable behavior" to begin with anyway?