425
top 50 comments
sorted by: hot top controversial new old
[-] Buffalox@lemmy.world 88 points 4 months ago

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

[-] bjoern_tantau@swg-empire.de 164 points 4 months ago

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 147 points 4 months ago

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 4 months ago

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 4 months ago* (last edited 4 months ago)

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 4 months ago

Jesus that was one hell of a thread

[-] anguo@lemmy.ca 3 points 4 months ago

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

[-] unique_hemp@discuss.tchncs.de 4 points 4 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 4 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 4 months ago

Works as well.

[-] billwashere@lemmy.world 7 points 4 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 4 months ago

That is a large part of coding

[-] mondoman712@lemmy.ml 92 points 4 months ago
[-] ChaoticNeutralCzech@lemmy.one 35 points 4 months ago* (last edited 4 months ago)

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

from __future__ import antigravity
load more comments (1 replies)
[-] grue@lemmy.world 26 points 4 months ago

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

[-] dandroid@sh.itjust.works 5 points 4 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 4 months ago

More like all the research teams.

load more comments (1 replies)
[-] mac@infosec.pub 16 points 4 months ago

"I also sampled everything in the medicine cabinet"

This made me smile.

[-] RobertoOberto@sh.itjust.works 3 points 4 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 4 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

load more comments (1 replies)
[-] CanadaPlus 39 points 4 months ago* (last edited 4 months ago)

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 4 months ago

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

[-] akhial@lemmy.world 32 points 4 months ago

It's funny because

from apps import facebook-killer as fb

fb.start()

// 3 million seed investment 

[-] zaphod@sopuli.xyz 12 points 4 months ago
[-] pewpew@feddit.it 4 points 4 months ago

: Inconstistent indentation

[-] lupec@lemm.ee 5 points 4 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

[-] qx128@lemmy.world 58 points 4 months ago

Hahaha now code-golf it. One line FTW!

remove(Image.open(‘cl.jpeg’)).save(‘output.png’)

[-] Tangent5280@lemmy.world 58 points 4 months ago

If I find this in production I'm whipping your ballsack till you change it back.

[-] Jumuta@sh.itjust.works 19 points 4 months ago

import("rembg").remove(import("PIL").Image.open(‘cl.jpeg’)).save(‘output.png’)

[-] _edge@discuss.tchncs.de 15 points 4 months ago

Can i hire you?

[-] hackris@lemmy.ml 9 points 4 months ago

So I'm not going to change it

[-] madcaesar@lemmy.world 5 points 4 months ago

Code golf! I just learned something new 😂

[-] sexual_tomato@lemmy.dbzer0.com 10 points 4 months ago

https://codegolf.stackexchange.com/

Enjoy a new rabbit hole to dive down

load more comments (2 replies)
[-] anzo@programming.dev 57 points 4 months ago

This is exactly why we love Python (and other languages with rich package ecosystem, even when only on their niche usage cases). You can build upon other people's knowledge and effort to do cool things efficiently and effectively!

[-] toddestan@lemm.ee 33 points 4 months ago* (last edited 4 months ago)

That reminds me back when some time ago, I was tired of dealing with sketchy, and often broken, websites and programs for downloading videos from Youtube. I figured these sorts of programs must be doing something along the lines of downloading the Youtube page, parsing through the massive pile of HTML and Javascript to find the stream, and then saving that to a video file. That seemed like something I could do myself with Python, so I set out to see if I could figure out how to do it.

A few minutes and a couple of web searches later, I discovered that someone else had figured that all out already and I just needed to do "pip install pytube".

[-] MazonnaCara89@lemmy.ml 35 points 4 months ago

Have you ever heard about yt-dl?

[-] toddestan@lemm.ee 9 points 4 months ago

I did switch over to yt-dlp some time later as development seems to have slowed on Pytube and yt-dlp seems to be where all the activity is.

[-] backhdlp@iusearchlinux.fyi 30 points 4 months ago

There's a python library for everything

[-] Thcdenton@lemmy.world 28 points 4 months ago
[-] aluminium@lemmy.world 4 points 4 months ago* (last edited 4 months ago)

*the libraries that are made for python

[-] johannesvanderwhales@lemmy.world 25 points 4 months ago

Remove seems like a terrible name for that method.

[-] SkyeStarfall@lemmy.blahaj.zone 16 points 4 months ago

While yes, the true issue here is that, for some reason, the code only imports the remove method from the package, instead of importing the package and doing rembg.remove().

[-] trashgirlfriend@lemmy.world 3 points 4 months ago

if you only wanted to import remove you could maybe import as rembg_remove

unless there's some weird taboo against doing that I don't know about, I'm an awful programmer tbh

[-] shootwhatsmyname@lemm.ee 17 points 4 months ago

Waiting for the “in one line” tutorial

[-] j4k3@lemmy.world 13 points 4 months ago

No work in micropython on uno? pls help. Need thesis in Rust do tomorgh. Removed French bloat rm -fr catz tut. Why

[-] SanndyTheManndy@lemmy.world 7 points 4 months ago
[-] essell@lemmy.world 7 points 4 months ago

All the best things in life are intangible.

[-] AceFuzzLord@lemm.ee 5 points 4 months ago

I know this is a joke, but I totally wanna run the code and see what happens or what errors I get just for fun.

[-] captain_aggravated@sh.itjust.works 3 points 4 months ago

According to PyPI, the library is genuine.

load more comments
view more: next ›
this post was submitted on 03 Apr 2024
425 points (89.1% liked)

Programmer Humor

31687 readers
30 users here now

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

Rules:

founded 5 years ago
MODERATORS