this post was submitted on 28 Jul 2024
1301 points (99.0% liked)

Programmer Humor

19623 readers
1 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] ptz@dubvee.org 251 points 3 months ago* (last edited 3 months ago)

Mom, can we stop and get some Python?

No, we have Python at home.

Python at home....

[–] TunaCowboy@lemmy.world 197 points 3 months ago* (last edited 3 months ago) (5 children)

What if I prefer this?

#define CURLYOPENRIGHTCLOSEDLEFTBRACKET {
#define CURLYOPENLEFTCLOSEDRIGHTBRACKET }
#define CURVYOPENRIGHTCLOSEDLEFTBRACKET (
#define CURVYOPENLEFTCLOSEDRIGHTBRACKET )
#define PERIODWITHPERIODONTOP :
#define COMMAWITHPERIODONTOP ;

int main CURVYOPENRIGHTCLOSEDLEFTBRACKET CURVYOPENLEFTCLOSEDRIGHTBRACKET CURLYOPENRIGHTCLOSEDLEFTBRACKET
  if CURVYOPENRIGHTCLOSEDLEFTBRACKET 1 CURVYOPENLEFTCLOSEDRIGHTBRACKET CURLYOPENRIGHTCLOSEDLEFTBRACKET
    asm volatile CURVYOPENRIGHTCLOSEDLEFTBRACKET
      "mov $1, %%rax\n"
      "mov $1, %%rdi\n"
      "lea message(%%rip), %%rsi\n"
      "mov $4, %%edx\n"
      "syscall\n"
      PERIODWITHPERIODONTOP
      PERIODWITHPERIODONTOP
      PERIODWITHPERIODONTOP "%rax", "%rdi", "%rsi", "%rdx"
    CURVYOPENLEFTCLOSEDRIGHTBRACKET COMMAWITHPERIODONTOP
  CURLYOPENLEFTCLOSEDRIGHTBRACKET
  return 0 COMMAWITHPERIODONTOP
CURLYOPENLEFTCLOSEDRIGHTBRACKET

asm CURVYOPENRIGHTCLOSEDLEFTBRACKET ".section .data\n"
  "message: .ascii \"wut\\n\"\n"
  ".section .text\n" CURVYOPENLEFTCLOSEDRIGHTBRACKET COMMAWITHPERIODONTOP
[–] humbletightband@lemmy.dbzer0.com 92 points 3 months ago (2 children)

You can't be helped, sorry. We will put you to an asylum for people like you

[–] milicent_bystandr@lemm.ee 28 points 3 months ago (1 children)

Asylum? We have the electric chair for this.

load more comments (1 replies)
load more comments (1 replies)
[–] z500@startrek.website 49 points 3 months ago* (last edited 3 months ago) (1 children)

You win a free trip to the Hague

[–] SkyezOpen@lemmy.world 17 points 3 months ago (2 children)

They don't even deserve the trial. Straight to gulag.

load more comments (2 replies)
[–] dariusj18@lemmy.world 28 points 3 months ago (1 children)

Can this be done with emoji?

load more comments (1 replies)
[–] xmunk@sh.itjust.works 20 points 3 months ago

Acceptable, just FYI I added a pre-commit git hook, please rebase your changes.

[–] MajorHavoc@programming.dev 18 points 3 months ago

Thanks. I hate it.

[–] sunglocto@lemmy.zip 94 points 3 months ago (5 children)

Idk why but i fell in love with this and might just use it now

[–] Vilian@lemmy.ca 28 points 3 months ago
load more comments (4 replies)
[–] solidgrue@lemmy.world 82 points 3 months ago* (last edited 3 months ago) (9 children)

Looks like Python, but in an editor with a weird TUI scrollbar

[–] subignition@fedia.io 85 points 3 months ago (2 children)

High chance that it's a Python programmer who is really unhappy about having to work in Java, lol

[–] tan00k@lemmy.world 16 points 3 months ago

Agreed. I saw this and thought it looked beautifully passive aggressive

load more comments (1 replies)
load more comments (8 replies)
[–] Fillicia@sh.itjust.works 77 points 3 months ago (7 children)
[–] mariusafa@lemmy.sdf.org 36 points 3 months ago

Literally me every time I want to program something slightly complex in Python.

[–] gofsckyourself@lemmy.world 21 points 3 months ago (1 children)
[–] Fillicia@sh.itjust.works 25 points 3 months ago (3 children)

YAML makes you appreciate Python's 4 spaces indentation.

[–] victorz@lemmy.world 13 points 3 months ago (10 children)

I thought python allowed whatever indentation you wanted as long as it's consistent?

[–] Fillicia@sh.itjust.works 20 points 3 months ago

pep8 calls for 4 space but it is a guidance not a rule.

Google internal style guide recommend(ed?) 2 spaces to accomodate the line length limit.

load more comments (9 replies)
load more comments (2 replies)
load more comments (5 replies)
[–] savvywolf@pawb.social 75 points 3 months ago (1 children)

Whitespace isn't semantically important. Ticket closed.

[–] DrWeevilJammer@lemmy.ml 22 points 3 months ago

That would be a very satisfying ticket closure

[–] AlexWIWA@lemmy.ml 74 points 3 months ago

Python with extra steps

[–] Treczoks@lemmy.world 61 points 3 months ago (3 children)

Python programmer encountering a real programming language for the first time.

load more comments (3 replies)
[–] mox@lemmy.sdf.org 60 points 3 months ago* (last edited 3 months ago) (14 children)

Growing up with C made me assume semicolons and braces were needed to avoid subtle bugs, but experience with more recent languages showed me that it's possible to reliably parse the same semantic cues that humans use: indentation, parentheses, and other such context. (Perhaps this was less viable when C was invented, due to more constrained hardware.)

I was skeptical at first, but in practice, I have never encountered a bug caused by this approach in Python, Nim, or any other language implementing it consistently, over the course of a decade or two using them. Meanwhile, I have seen more than a few bugs caused by brace and semicolon mistakes.

So nowadays (outside of niche & domain-specific languages) I see braces and semicolons as little more than annoying noise and fuel for religious arguments.

[–] magic_lobster_party@kbin.run 34 points 3 months ago (3 children)

In Java it’s quite difficult to forget semicolon and still have a syntactically correct program.

I think braces are incredibly important. With Python it can be confusing which indentation is correct when copying code between files. Different indentations can easily be still syntactically correct, but the outcome is vastly different. It’s often I have to double and triple check to verify I copied the code with correct indentation.

load more comments (3 replies)
load more comments (13 replies)
[–] MadMadBunny@lemmy.ca 55 points 3 months ago (1 children)
[–] Skullgrid@lemmy.world 45 points 3 months ago (1 children)

.... whitespace is whitespace.

load more comments (1 replies)
[–] SlothMama@lemmy.world 45 points 3 months ago (1 children)

I low key love it. It's unconventional, but it's not hard to read

[–] repungnant_canary@lemmy.world 28 points 3 months ago (2 children)

it's not hard to read

Until there's missing brace somewhere

load more comments (2 replies)
[–] pineapplelover@lemm.ee 44 points 3 months ago (4 children)

I was like, "where are the braces?". Then, I turned to the right

load more comments (4 replies)
[–] Heavybell@lemmy.world 43 points 3 months ago* (last edited 3 months ago) (2 children)

This looks like a python programmer that is mad they have to write ~~C#~~ Java…

load more comments (2 replies)
[–] NigelFrobisher@aussie.zone 40 points 3 months ago* (last edited 3 months ago) (1 children)

My credo on this kind of thing is never do something that will make your successor so mad that they find out where you live and post parts of your body to Interpol.

load more comments (1 replies)
[–] match@pawb.social 40 points 3 months ago (1 children)

This should be its own language. Pyava.

[–] jwt@programming.dev 30 points 3 months ago (1 children)

Or Jathon (pronounced like Mike Tyson would pronounce JSON)

[–] runeko@programming.dev 20 points 3 months ago

Or we can round out the confusion and call it PythonScript

[–] Revan343@lemmy.ca 38 points 3 months ago

I kinda like it, easy to see unbalanced braces

[–] nexussapphire@lemm.ee 37 points 3 months ago (6 children)

Last day at the company, pushed over 5,000 commits. Just style changes, still passes all the checks.

load more comments (6 replies)
[–] Sanctus@lemmy.world 34 points 3 months ago (1 children)
load more comments (1 replies)
[–] Hack3900@lemy.lol 34 points 3 months ago (11 children)
load more comments (11 replies)
[–] Binette@lemmy.ml 33 points 3 months ago

Pseudo-python

[–] alcasa@lemmy.sdf.org 23 points 3 months ago

That would be very cool to have in a code autoformatter

[–] wesker@lemmy.sdf.org 23 points 3 months ago

bro what the fuck

[–] MTK@lemmy.world 22 points 3 months ago

Honestly, looks neat, might adopt this

[–] OhStopYellingAtMe@lemmy.world 20 points 3 months ago

Damn. That’s tidy to the point of inconvenience.

[–] MystikIncarnate@lemmy.ca 17 points 3 months ago (1 children)

I'm not a coder, and.... Well... Thanks, I hate it.

Even I know this is horrific. Where the fuck does this statement end? Which of these brackets refer to this section of other brackets. Idfk.

I could give a shit less if it was just for a single block per or something but ";}}}" hurts me.

[–] velvetThunder@lemmy.zip 16 points 3 months ago (1 children)

Well the code indentation explains that, like python. The issue is not reading it. You would rather quit your job than edit this.

load more comments (1 replies)
[–] demizerone@lemmy.world 15 points 3 months ago (2 children)

Auto formatter as part of the expected language tooling is Go's greatest move, even if their formatter doesn't go far enough.

load more comments (2 replies)
[–] superkret@feddit.org 14 points 3 months ago (1 children)

The braces need indentation, of course.

load more comments (1 replies)
[–] magic_lobster_party@kbin.run 14 points 3 months ago* (last edited 3 months ago)

I’m more concerned about that poor stack with all those recursions.

It’s also ~~O(n^2)~~ O(n!). I’m not sure what they’re trying to do, but I’m sure it can be done in O(n) (or at least polynomial).

Reject.

load more comments
view more: next ›