88 points

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

permalink
report
reply
163 points

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

permalink
report
parent
reply
147 points

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.

permalink
report
parent
reply
41 points

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.

permalink
report
parent
reply
24 points

Works as well.

permalink
report
parent
reply
7 points

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.

permalink
report
parent
reply
5 points

That is a large part of coding

permalink
report
parent
reply
92 points

It’s basically import antigravity

permalink
report
parent
reply
35 points
*

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

from __future__ import antigravity
permalink
report
parent
reply
26 points

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

permalink
report
parent
reply
16 points

“I also sampled everything in the medicine cabinet”

This made me smile.

permalink
report
parent
reply
3 points

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.

permalink
report
parent
reply
30 points
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

permalink
report
parent
reply
1 point

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

permalink
report
parent
reply
39 points
*

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

permalink
report
parent
reply
9 points

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

permalink
report
parent
reply
32 points

It’s funny because

from apps import facebook-killer as fb

fb.start()

// 3 million seed investment 

permalink
report
parent
reply
12 points

SyntaxError

permalink
report
parent
reply
4 points

: Inconstistent indentation

permalink
report
parent
reply
5 points

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

permalink
report
parent
reply
58 points

Hahaha now code-golf it. One line FTW!

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

permalink
report
reply
59 points

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

permalink
report
parent
reply
19 points

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

permalink
report
parent
reply
15 points

Can i hire you?

permalink
report
parent
reply
9 points

So I’m not going to change it

permalink
report
parent
reply
5 points

Code golf! I just learned something new 😂

permalink
report
parent
reply
10 points

https://codegolf.stackexchange.com/

Enjoy a new rabbit hole to dive down

permalink
report
parent
reply
2 points
*

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.

permalink
report
parent
reply
2 points

I haven’t either but I like it.

permalink
report
parent
reply
58 points

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!

permalink
report
reply
33 points
*

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”.

permalink
report
reply
35 points

Have you ever heard about yt-dl?

permalink
report
parent
reply
14 points

yt-dlp

permalink
report
parent
reply
9 points

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.

permalink
report
parent
reply
30 points

There’s a python library for everything

permalink
report
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

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

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 6.8K

    Monthly active users

  • 1.4K

    Posts

  • 32K

    Comments