r/AskProgramming • • Sep 28 '26

cursed python hello world

Is there any way to make this code wok in python?

"hello"(print)

This is just a joke and i do not care how cursed of a setup this requires.
0 Upvotes

14 comments sorted by

View all comments

Show parent comment

1

u/Gnaxe Sep 28 '26

You can with __call__(), but that doesn't work on built-in types like str, which are not patchable. A string subclass could totally override that, but that's not the object resulting from a string literal, short of some much deeper magic (which Python has).