MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1p6gqcf/random_meme_about_my_coding_skills/
r/programminghorror • u/jirniy_uiban1 • Nov 25 '25
28 comments sorted by
73
def HelloWorld(txt): print("Hello World!")
63 u/TheKodeToad Nov 25 '25 This version is better - you can pass any function name and it will be called with "Hello World!"!def HelloWorld(func_expr): eval(func_expr)("Hello World!") 5 u/Shelbyville Nov 26 '25 D'oh was about to write something similar 3 u/Shelbyville Nov 26 '25 To use the HelloWorld function name part to:import sys def HelloWorld(fn): eval("{}('{}')".format(fn, sys._getframe().f_code.co_name)) # output -> HelloWorld HelloWorld("print") 2 u/mrheosuper Nov 27 '25 Not python dev, but what if you pass function that expect more than 1 param ? 1 u/Escarlatum Dec 07 '25 You get an error I suppose 18 u/Mc_UsernameTaken [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Nov 25 '25 def HelloWorld(txt): if txt == "print": print("Hello World!") else: pass 13 u/AlexMTBDude Nov 25 '25 You're making it too complicated. This is all you need:HelloWorld = print Helloworld("print") 3 u/shinitakunai Nov 26 '25 Thanks. I saw this as the obvious answer and all other people are overcomplicating a simple thing. -5 u/gaijingreg Nov 25 '25 E: 'txt' is declared but never used. 7 u/tarman34 Nov 25 '25 But this is not error, right? 5 u/gaijingreg Nov 25 '25 Depends how you configure your linter 2 u/Nick_Zacker Nov 26 '25 Looks more like a warning than an error, no? 4 u/gaijingreg Nov 26 '25 edited Nov 26 '25 Again, it depends on your configuration and which linter you use.For example, I think the eslint:recommended ruleset defaults to error for no-unused-vars but you can set it to warning or turn it off in your .eslintrc
63
This version is better - you can pass any function name and it will be called with "Hello World!"!
def HelloWorld(func_expr): eval(func_expr)("Hello World!")
5 u/Shelbyville Nov 26 '25 D'oh was about to write something similar 3 u/Shelbyville Nov 26 '25 To use the HelloWorld function name part to:import sys def HelloWorld(fn): eval("{}('{}')".format(fn, sys._getframe().f_code.co_name)) # output -> HelloWorld HelloWorld("print") 2 u/mrheosuper Nov 27 '25 Not python dev, but what if you pass function that expect more than 1 param ? 1 u/Escarlatum Dec 07 '25 You get an error I suppose
5
D'oh was about to write something similar
3
To use the HelloWorld function name part to:
import sys def HelloWorld(fn): eval("{}('{}')".format(fn, sys._getframe().f_code.co_name)) # output -> HelloWorld HelloWorld("print")
2
Not python dev, but what if you pass function that expect more than 1 param ?
1 u/Escarlatum Dec 07 '25 You get an error I suppose
1
You get an error I suppose
18
def HelloWorld(txt): if txt == "print": print("Hello World!") else: pass
13
You're making it too complicated. This is all you need:
HelloWorld = print Helloworld("print")
3 u/shinitakunai Nov 26 '25 Thanks. I saw this as the obvious answer and all other people are overcomplicating a simple thing.
Thanks. I saw this as the obvious answer and all other people are overcomplicating a simple thing.
-5
E: 'txt' is declared but never used.
7 u/tarman34 Nov 25 '25 But this is not error, right? 5 u/gaijingreg Nov 25 '25 Depends how you configure your linter 2 u/Nick_Zacker Nov 26 '25 Looks more like a warning than an error, no? 4 u/gaijingreg Nov 26 '25 edited Nov 26 '25 Again, it depends on your configuration and which linter you use.For example, I think the eslint:recommended ruleset defaults to error for no-unused-vars but you can set it to warning or turn it off in your .eslintrc
7
But this is not error, right?
5 u/gaijingreg Nov 25 '25 Depends how you configure your linter 2 u/Nick_Zacker Nov 26 '25 Looks more like a warning than an error, no? 4 u/gaijingreg Nov 26 '25 edited Nov 26 '25 Again, it depends on your configuration and which linter you use.For example, I think the eslint:recommended ruleset defaults to error for no-unused-vars but you can set it to warning or turn it off in your .eslintrc
Depends how you configure your linter
2 u/Nick_Zacker Nov 26 '25 Looks more like a warning than an error, no? 4 u/gaijingreg Nov 26 '25 edited Nov 26 '25 Again, it depends on your configuration and which linter you use.For example, I think the eslint:recommended ruleset defaults to error for no-unused-vars but you can set it to warning or turn it off in your .eslintrc
Looks more like a warning than an error, no?
4 u/gaijingreg Nov 26 '25 edited Nov 26 '25 Again, it depends on your configuration and which linter you use.For example, I think the eslint:recommended ruleset defaults to error for no-unused-vars but you can set it to warning or turn it off in your .eslintrc
4
Again, it depends on your configuration and which linter you use.
For example, I think the eslint:recommended ruleset defaults to error for no-unused-vars but you can set it to warning or turn it off in your .eslintrc
26
#include <iostream> #include <string> struct PrintLiteral { std::string text; void operator()(std::ostream& os) const { os << text << std::endl; } }; PrintLiteral operator"" _print(const char* str, std::size_t len) { return PrintLiteral{ std::string(str, len) }; } int main() { "helloworld"_print(std::cout); }
2 u/evmo_sw Nov 29 '25 Put this back in hell
Put this back in hell
21
12[array];
5 u/HugoNikanor Nov 26 '25 For those unaware, that is perfectly valid C code, and in everything except spelling identical to array[12]. 6 u/rarenick Nov 26 '25 To elaborate further,*(array + 12) = *(12 + array) in terms of pointer arithmetic. 2 u/snf Nov 26 '25 This is my second favourite perversion in C and its ilk. The first is Duff's Device
For those unaware, that is perfectly valid C code, and in everything except spelling identical to array[12].
array[12]
6 u/rarenick Nov 26 '25 To elaborate further,*(array + 12) = *(12 + array) in terms of pointer arithmetic.
6
To elaborate further,
*(array + 12) = *(12 + array) in terms of pointer arithmetic.
This is my second favourite perversion in C and its ilk. The first is Duff's Device
10
Someone unironically did python library that interchanges argument and function name but I can't seem to find it
2 u/Not_Artifical Nov 26 '25 That doesn’t sound hard to make
That doesn’t sound hard to make
POV: when you finally decide to code without AI
Someone should make a coding language where everything is backwards So a function would be :()func def
0
I always do it like this, is there any other way??
-2
This sub isn't for memes. Perhaps you're looking for r/ProgrammerHumor?
/help
/kill @s
73
u/tarman34 Nov 25 '25
26
u/hicklc01 Nov 25 '25
21
u/maelstrom071 Nov 25 '25
12[array];10
u/ThNeutral Nov 25 '25
Someone unironically did python library that interchanges argument and function name but I can't seem to find it
3
u/No_Size2293 Nov 26 '25
POV: when you finally decide to code without AI
1
u/TroPixens Nov 29 '25
Someone should make a coding language where everything is backwards So a function would be :()func def
0
u/Shelbyville Nov 26 '25
I always do it like this, is there any other way??
-2
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Nov 25 '25
This sub isn't for memes. Perhaps you're looking for r/ProgrammerHumor?
1
u/T55_Ad Nov 26 '25
/help
/kill @s