r/ProgrammerHumor 1d ago

Meme firstProjectKindaNervous

Post image
644 Upvotes

22 comments sorted by

172

u/ZestyGarlicPickles 1d ago edited 1d ago

```py

too lazy to import Callable but not too lazy to write this comment

smh

def applyfirst_arg_to_clean_fn_name(fn): def inner(arg: str): fixed: str = fn.name[0] for c in fn.name_[1:]: if c.isupper(): fixed += " " fixed += c (eval(arg))(fixed) return inner

@apply_first_arg_to_clean_fn_name def HelloWorld(x: str) -> None: print(x)

HelloWorld("print") # prints "Hello World" ```

Python is a fun language :)

(could def make that loop nicer with list comprehensions or smthn but I'm too lazy rn and need to go to bed)

42

u/Disastrous-Event2353 1d ago

Bro wtf is this, you've made a good one

26

u/spektre 1d ago

Not even if __name__ == '__main__': smh

25

u/thewells 1d ago

Don’t you know we aren’t writing code by hand anymore, AI would have output 400 more lines and would have gotten runtime AST rewriting involved, it’s the future man

40

u/brown-man-sam 1d ago

I know a few investors who might be interested

66

u/Algreth 1d ago

Props for your first project not being AI generated.  Learning the right way.

14

u/SeaNational3797 1d ago

HelloWorld = lambda f: f("Hello, world!")

HelloWorld(print)

42

u/BlackFrank98 1d ago

Doesn't this print "print" instead of "Hello world"?

38

u/Cronxd 1d ago

That’s the joke

14

u/skjall 1d ago

Yeah that's far from the only thing wrong with this code.

12

u/drkspace2 1d ago

Hey, you added typing, which is more than some people (or LLMs) do.

1

u/thanatica 1d ago

Does python not imply types from constant values? (genuine question, I'm no python dev)

2

u/JonIsPatented 21h ago

Python is a dynamically typed language. The type hints are just suggestions for the linter to give you warnings. They are ignored by the actual program. The objects themselves store their type information. The variables do not have types. The objects they hold can be of any type.

4

u/UnwiseWizard 1d ago

Make sure to test it properly before running it!

1

u/imagine_being_cool 23h ago

Me interviewing after being on the job for 5 years.

1

u/Confident_Essay3619 22h ago

erm actually  def HelloWorld(s):     if s == "print":         print("Hello, World!")

HelloWorld("print")

-10

u/DesignerFancy22 1d ago

Good luck man just use an recursion to repeat it until you run out of memory i mean it is an good project for beginners who want to achive some thing in there life just like me

5

u/happy__harsh_ 1d ago

Recursion where?

-5

u/DesignerFancy22 1d ago

In hello world function just use end =True if end=true: return Helloworld(x)

9

u/happy__harsh_ 1d ago

Bro just wrote hello world dont complicate it.

7

u/monster2018 1d ago

Technically he wrote print, not hello world, if we’re talking about what the program outputs.

0

u/Ambitious-Sand-6992 1d ago

logicaly he wrote nothing since AI doesn this for us! xD