this post was submitted on 11 Dec 2023
1161 points (98.9% liked)
Programmer Humor
32435 readers
334 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
This is the code (Github link):
What happens is that the python repl calls
__repr__
automatically on each variable/statement that you type into the repl (except assignments e.g.x = 1
). But this basically only happens in the repl. So "executing" onlyexit
wouldn't work in a python script as it is not calling__repr__
automatically, so better you learn how to do it right than using justexit
in your python scripts and scratching your head why it works in the repl but not in your code.