HStone32,

Having a similar moment right now. I’m trying to figure out how to compute the transformation matrix for reflecting a bitmap of any given dimension across the y axis, but all the tutorials that come up in my search just tell me to import some python library. Its like nobody wants to learn how to do anything anymore.

johannesvanderwhales,

Remove seems like a terrible name for that method.

SkyeStarfall,

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,

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

toddestan,

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,
@MazonnaCara89@lemmy.ml avatar

Have you ever heard about yt-dl?

toddestan,

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.

aBundleOfFerrets,

yt-dlp

shootwhatsmyname,
@shootwhatsmyname@lemm.ee avatar

Waiting for the “in one line” tutorial

j4k3,
@j4k3@lemmy.world avatar

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

anzo,

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!

SanndyTheManndy,

Python is an illusion

essell,

All the best things in life are intangible.

qx128,

Hahaha now code-golf it. One line FTW!

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

madcaesar,

Code golf! I just learned something new 😂

meekah,
@meekah@lemmy.world avatar

You never heard of code Golf before? It’s usually programming challenges where the goal is to use the smallest number of source code characters possible.

Soulg,

I haven’t either but I like it.

sexual_tomato,

codegolf.stackexchange.com

Enjoy a new rabbit hole to dive down

Tangent5280,

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

hackris,

So I’m not going to change it

Jumuta,

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

_edge,

Can i hire you?

AceFuzzLord,

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,
@captain_aggravated@sh.itjust.works avatar

According to PyPI, the library is genuine.

backhdlp,
@backhdlp@iusearchlinux.fyi avatar

There’s a python library for everything

Thcdenton,

Goddamn i love python

aluminium,

*the libraries that are made for python

Buffalox,

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

CanadaPlus, (edited )

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

Buffalox,

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

akhial,
@akhial@lemmy.world avatar

It’s funny because


<span style="color:#323232;">from apps import facebook-killer as fb
</span><span style="color:#323232;">
</span><span style="color:#323232;">fb.start()
</span><span style="color:#323232;">
</span><span style="color:#323232;">// 3 million seed investment 
</span><span style="color:#323232;">
</span>
zaphod,

SyntaxError

pewpew,
@pewpew@feddit.it avatar

: Inconstistent indentation

bjoern_tantau,
@bjoern_tantau@swg-empire.de avatar

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

mac,
@mac@infosec.pub avatar

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.

bjoern_tantau,
@bjoern_tantau@swg-empire.de avatar

Works as well.

lowleveldata,

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,

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: bitbucket.org/…/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,

Jesus that was one hell of a thread

anguo,

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

Gabu,

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.

unique_hemp,

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?

WolfLink,

That is a large part of coding

billwashere,

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.

mondoman712,

It’s basically import antigravity

ChaoticNeutralCzech,

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


<span style="font-weight:bold;color:#a71d5d;">from </span><span style="color:#323232;">__future__ </span><span style="font-weight:bold;color:#a71d5d;">import </span><span style="color:#323232;">antigravity
</span>
Gabu,

Future libraries still makes me laugh.

mac,
@mac@infosec.pub avatar

“I also sampled everything in the medicine cabinet”

This made me smile.

grue,

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

dandroid,

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,

More like all the research teams.

Bene7rddso,

And 10 years

RobertoOberto,

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.

billwashere,

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

otter,

<span style="color:#323232;">from Lemmy import Upvote
</span><span style="color:#323232;">from Fediverse import Posts
</span><span style="color:#323232;">from ActivityPub import Submit
</span><span style="color:#323232;">
</span><span style="color:#323232;">target_post = 'https://lemmy.ca/post/18691085'
</span><span style="color:#323232;">num_votes = 8
</span><span style="color:#323232;">
</span><span style="color:#323232;">post = Posts.open(target_post)
</span><span style="color:#323232;">
</span><span style="color:#323232;">package = Upvote(post, num_votes)
</span><span style="color:#323232;">
</span><span style="color:#323232;">package.Submit(target_post)
</span>

or something

lupec,

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

  • All
  • Subscribed
  • Moderated
  • Favorites
  • programmerhumor@lemmy.ml
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines