Python with 'end' like Ruby? A hack that'll make you smile
An enthusiast proposes adding 'end' keyword to Python for block termination — and it's not a joke, but a clever hack.

Remember how in Ruby or Lua blocks end with an elegant end instead of indentation? One developer decided Python deserves that luxury too and whipped up a hack that lets you write end instead of watching your whitespace. Spoiler: it's not a CPython patch, but a neat trick with decorators and context managers.
The idea is simple: wrap the block in a construct that on __exit__ checks if end was called. Looks like magic, but it's really a smelly crutch. The author admits: it's not for production, just for fun and experimentation. But wouldn't it be nice to write:
if condition:
print('Hello')
end
Of course, the Python community is unlikely to adopt this — the Zen of Python says "Explicit is better than implicit," and indentation is already the language's trademark. But the fact that someone bothered is admirable. After all, we all love hacker approaches, even if they're useless.
METABYTE studio comment: While we don't recommend using such hacks in production (imagine your colleague hunting for that end in code review), it's a great example of how you can extend a language for prototyping. If you need robust code — we'll help; if you want to experiment — go for it!
NEXT STEP
Liked the approach?
We apply the same principles to client projects: AI, automation, products that don't die after launch.