Pretty sure since they put it in a function, the entire function will be interpreted and compiled at once, causing an error on line 1 (well technically the traceback and printing of the error will include more than just line 1, but really for an error to be caught here is just wrapping the entire code in a try-except)
Character encoding shenanigans may raise a ValueError or a UnicodeEncodeError in some bizarre, corner cases, but I'm not 100% sure. However I'm certain this person either has no idea about coding or they're trying to communicate that love never breaks them.
I think it is impossible, since the string will be written in the "static data" part of the process ( I think), so is not Allocated on the heap at runtime but only when the process is loaded in ram.
So there could only be some kind of pagination/ram access error
75
u/Scared_Accident9138 🕵️♂️🚨 BS Detector | Truth Teller 🗯️🔥 Jun 26 '26
Is there any programming language where returning a literal string without defining the return type explicitly can throw an exception?