this post was submitted on 03 Apr 2024
424 points (89.1% liked)

Programmer Humor

32472 readers
894 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Buffalox@lemmy.world 89 points 7 months ago (4 children)

How is this funny? 8 Upvotes at current writing???

[–] bjoern_tantau@swg-empire.de 162 points 7 months ago (4 children)

It's kind of funny because it looks like it is nonsense dreamt up by a non-programmer. But it actually works.

[–] mac@infosec.pub 146 points 7 months ago (4 children)

I thought it was poking fun at the tutorial saying instead of learning to code, import a library from someone who knows how to code.

[–] lowleveldata@programming.dev 41 points 7 months ago (1 children)

That's what libraries are for. I'm no security expert and the sensible thing to do is using a library instead of taking a class.

[–] bort@sopuli.xyz 25 points 7 months ago* (last edited 7 months ago) (3 children)

I’m no security expert and the sensible thing to do is using a library instead of taking a class.

Counterpoint: "not knowing your libraries" + "blind trust in the maintainer" will give you stuff like this: https://bitbucket.org/snakeyaml/snakeyaml/issues/561/cve-2022-1471-vulnerability-in

(the thread itself is worth a read. But also very impressive is the list of big players who fell for exactly this mentality)

[–] gears@sh.itjust.works 7 points 7 months ago (1 children)

Jesus that was one hell of a thread

[–] anguo@lemmy.ca 3 points 7 months ago

I dont want to see the words "low quality tooling" ever again.

[–] unique_hemp@discuss.tchncs.de 4 points 7 months ago

Love the part where he claims that if your users are authenticated, it's not untrusted input. I mean, surely you trust all of your users to run any code on your server, right?

[–] Gabu@lemmy.ml 3 points 7 months ago

Impressive and unsurprising. As soon as you start getting complex libraries with multiple dependencies it becomes nearly impossible to review everything. At one time I had an interest in contributing to some AI libraries, but they're a mess as soon as you go looking for points of improvement.

[–] bjoern_tantau@swg-empire.de 24 points 7 months ago

Works as well.

[–] billwashere@lemmy.world 7 points 7 months ago

Which is funny because when I first started my CS degree in the late 80s (get off my lawn) we used to make fun of the beginning Java classes because it seems 90% of coding was to import the right library.

[–] WolfLink@lemmy.ml 5 points 7 months ago

That is a large part of coding

[–] mondoman712@lemmy.ml 90 points 7 months ago (4 children)
[–] ChaoticNeutralCzech@lemmy.one 35 points 7 months ago* (last edited 7 months ago) (1 children)

Time travel is a prerequisite but don't worry, you can just

from __future__ import antigravity
[–] Gabu@lemmy.ml 1 points 7 months ago

Future libraries still makes me laugh.

[–] grue@lemmy.world 26 points 7 months ago (2 children)

It's literally this comic, five years and a research team later.

[–] dandroid@sh.itjust.works 5 points 7 months ago

It's funny how solvable that problem is now. I remember seeing that comic, I think over a decade ago now, and thinking about how true it was. It really shows you have far we've come in CS.

[–] tofubl@discuss.tchncs.de 4 points 7 months ago (1 children)

More like all the research teams.

[–] Bene7rddso@feddit.de 1 points 7 months ago
[–] mac@infosec.pub 16 points 7 months ago

"I also sampled everything in the medicine cabinet"

This made me smile.

[–] RobertoOberto@sh.itjust.works 3 points 7 months ago

From the hovertext: "I wrote 20 short programs in Python yesterday. It was wonderful. Perl, I'm leaving you."

After years of a dozen other languages, I finally tried Perl the other day.

Never again, if I can help it.

[–] otter@lemmy.ca 30 points 7 months ago
from Lemmy import Upvote
from Fediverse import Posts
from ActivityPub import Submit

target_post = 'https://lemmy.ca/post/18691085'
num_votes = 8

post = Posts.open(target_post)

package = Upvote(post, num_votes)

package.Submit(target_post)

or something

[–] billwashere@lemmy.world 1 points 7 months ago

Good because I was confused. I’ve written similar code

[–] CanadaPlus@lemmy.sdf.org 39 points 7 months ago* (last edited 7 months ago) (1 children)

Because this example isn't really programming, it's just calling an existing library. Which is the big joke about Python.

[–] Buffalox@lemmy.world 9 points 7 months ago

OK that way I get why it could be considered funny.

[–] akhial@lemmy.world 32 points 7 months ago (1 children)

It's funny because

from apps import facebook-killer as fb

fb.start()

// 3 million seed investment 

[–] zaphod@sopuli.xyz 12 points 7 months ago (1 children)
[–] pewpew@feddit.it 4 points 7 months ago

: Inconstistent indentation

[–] lupec@lemm.ee 5 points 7 months ago

My best guess is it's a play at the usual "all you do in python is import libraries without knowing how they work lololol" dig but yeah, I don't find it particularly funny either