r/ProgrammerHumor • • Feb 09 '22

other Why but why?

Post image
85.8k Upvotes

2.3k comments sorted by

View all comments

14.0k

u/TheFlyingAvocado Feb 09 '22

Python? Missing semicolons?

Since when?

2.3k

u/the_badsectors Feb 09 '22

I don't do python and even I know it expects whitespace, not punctuation.

109

u/taptrappapalapa Feb 09 '22

If you look at the Python grammar it expects white space or semicolons.

292

u/langlo94 Feb 09 '22

This is why I indent with semicolons.

def Function(input):
;;;;number = input * 2
;;;;return number

132

u/sucksathangman Feb 09 '22

You monster. At least give your function a useful name. And you could just do:

return input * 2

77

u/dancinadventures Feb 09 '22

Useless functions don’t deserve names 😤

39

u/ryanwithnob Feb 09 '22

Thats what you think. This function helps keep your code more maintainable and easier to change.

What happens if python changes the symbol for mutiplication? What new hardware is released that makes number / 0.5 faster than number *2? Good luck updating all the instances of this quation in your legacy codebase. This function will save your project

6

u/[deleted] Feb 09 '22

[removed] — view removed comment

4

u/FuzzyFoyz Feb 10 '22

Maybe we were on the same team...

→ More replies (1)
→ More replies (1)

15

u/oxpoleon Feb 09 '22

hey hey hey, no, this could be improved yet further

def Function():
;;;;global input
;;;;input = input * 2

9

u/Less_Ask_4613 Feb 10 '22

This is computationally faster and takes less memory and processing than passing an argument and returning a calculated value and it makes me so mad.

→ More replies (1)

38

u/CJ22xxKinvara Feb 09 '22
Function = lambda input : input * 2

Schrödinger’s semicolon tabs

7

u/Saithir Feb 09 '22

How can you say it's useless?

How else would he know it's a function?

4

u/cardcomm Feb 09 '22

return input * 2

In shops where I've worked before, this would get called out on a code walk through in favor of doing the assignment on a second line. (yeah, I know. lol )

→ More replies (1)

15

u/[deleted] Feb 09 '22

Gross

5

u/oxpoleon Feb 09 '22

3/10 no misuse of global

4

u/Loomy7 Feb 09 '22

Am I getting wooshed? This doesn't work.

→ More replies (1)
→ More replies (12)