The Wolf's Den
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
devilish666@lemmy.world to Programmer Humor@lemmy.ml · 1 year ago

Python tutorial moment

lemmy.world

message-square
56
fedilink
425

Python tutorial moment

lemmy.world

devilish666@lemmy.world to Programmer Humor@lemmy.ml · 1 year ago
message-square
56
fedilink
alert-triangle
You must log in or register to comment.
  • Buffalox@lemmy.world
    link
    fedilink
    arrow-up
    93
    arrow-down
    4
    ·
    1 year ago

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

    • Björn Tantau@swg-empire.de
      link
      fedilink
      arrow-up
      169
      arrow-down
      5
      ·
      1 year 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
        link
        fedilink
        arrow-up
        148
        arrow-down
        1
        ·
        1 year 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
          link
          fedilink
          arrow-up
          43
          arrow-down
          2
          ·
          1 year 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
            link
            fedilink
            arrow-up
            25
            ·
            edit-2
            1 year 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
              link
              fedilink
              arrow-up
              7
              ·
              1 year ago

              Jesus that was one hell of a thread

              • anguo@lemmy.ca
                link
                fedilink
                arrow-up
                3
                ·
                1 year ago

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

            • unique_hemp@discuss.tchncs.de
              link
              fedilink
              arrow-up
              4
              ·
              1 year 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
              link
              fedilink
              arrow-up
              3
              ·
              1 year 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.

        • Björn Tantau@swg-empire.de
          link
          fedilink
          arrow-up
          24
          ·
          1 year ago

          Works as well.

        • billwashere@lemmy.world
          link
          fedilink
          English
          arrow-up
          7
          ·
          1 year 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
          link
          fedilink
          arrow-up
          5
          ·
          1 year ago

          That is a large part of coding

      • mondoman712@lemmy.ml
        link
        fedilink
        arrow-up
        92
        ·
        1 year ago

        It’s basically import antigravity

        • ChaoticNeutralCzech@lemmy.one
          link
          fedilink
          arrow-up
          35
          ·
          edit-2
          1 year ago

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

          from __future__ import antigravity
          
          • Gabu@lemmy.ml
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            Future libraries still makes me laugh.

        • grue@lemmy.world
          link
          fedilink
          English
          arrow-up
          26
          ·
          1 year ago

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

          • Dandroid@sh.itjust.works
            link
            fedilink
            arrow-up
            5
            ·
            1 year 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
            link
            fedilink
            arrow-up
            4
            ·
            1 year ago

            More like all the research teams.

            • Bene7rddso@feddit.de
              link
              fedilink
              arrow-up
              1
              ·
              1 year ago

              And 10 years

        • mac@infosec.pub
          link
          fedilink
          arrow-up
          16
          ·
          1 year ago

          “I also sampled everything in the medicine cabinet”

          This made me smile.

        • RobertoOberto@sh.itjust.works
          link
          fedilink
          arrow-up
          3
          ·
          1 year 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
        link
        fedilink
        English
        arrow-up
        30
        ·
        1 year 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
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

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

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      43
      arrow-down
      4
      ·
      edit-2
      1 year 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
        link
        fedilink
        arrow-up
        9
        ·
        1 year ago

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

    • Adel Khial@lemmy.world
      link
      fedilink
      arrow-up
      32
      ·
      1 year ago

      It’s funny because

      from apps import facebook-killer as fb
      
      fb.start()
      
      // 3 million seed investment 
      
      
      • zaphod@sopuli.xyz
        link
        fedilink
        arrow-up
        13
        arrow-down
        1
        ·
        1 year ago

        SyntaxError

        • pewpew@feddit.it
          link
          fedilink
          arrow-up
          5
          arrow-down
          1
          ·
          1 year ago

          : Inconstistent indentation

    • Lupec@lemm.ee
      link
      fedilink
      arrow-up
      5
      ·
      1 year 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

  • adr1an@programming.dev
    link
    fedilink
    arrow-up
    60
    arrow-down
    2
    ·
    1 year 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!

  • qx128@lemmy.world
    link
    fedilink
    arrow-up
    59
    arrow-down
    1
    ·
    1 year ago

    Hahaha now code-golf it. One line FTW!

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

    • Tangent5280@lemmy.world
      link
      fedilink
      arrow-up
      60
      arrow-down
      2
      ·
      1 year ago

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

      • Jumuta@sh.itjust.works
        link
        fedilink
        arrow-up
        19
        ·
        1 year ago

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

      • _edge@discuss.tchncs.de
        link
        fedilink
        arrow-up
        15
        ·
        1 year ago

        Can i hire you?

      • hackris@lemmy.ml
        link
        fedilink
        arrow-up
        9
        ·
        1 year ago

        So I’m not going to change it

    • madcaesar@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      1 year ago

      Code golf! I just learned something new 😂

      • sexual_tomato@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        10
        ·
        1 year ago

        https://codegolf.stackexchange.com/

        Enjoy a new rabbit hole to dive down

      • silly goose meekah@lemmy.world
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        edit-2
        1 year ago

        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@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          I haven’t either but I like it.

  • toddestan@lemm.ee
    link
    fedilink
    arrow-up
    33
    ·
    edit-2
    1 year 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
      link
      fedilink
      arrow-up
      35
      ·
      1 year ago

      Have you ever heard about yt-dl?

      • ferret@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        14
        ·
        1 year ago

        yt-dlp

      • toddestan@lemm.ee
        link
        fedilink
        arrow-up
        9
        ·
        1 year 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.

  • Lunya \ she/it@iusearchlinux.fyi
    link
    fedilink
    arrow-up
    31
    arrow-down
    1
    ·
    1 year ago

    There’s a python library for everything

  • THCDenton@lemmy.world
    link
    fedilink
    arrow-up
    29
    arrow-down
    1
    ·
    1 year ago

    Goddamn i love python

    • aluminium@lemmy.world
      link
      fedilink
      arrow-up
      5
      arrow-down
      1
      ·
      edit-2
      1 year ago

      *the libraries that are made for python

  • johannesvanderwhales@lemmy.world
    link
    fedilink
    arrow-up
    25
    ·
    1 year ago

    Remove seems like a terrible name for that method.

    • SkyeStarfall@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      16
      ·
      1 year 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
        link
        fedilink
        arrow-up
        3
        ·
        1 year 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
    link
    fedilink
    English
    arrow-up
    17
    ·
    1 year ago

    Waiting for the “in one line” tutorial

  • 𞋴𝛂𝛋𝛆@lemmy.world
    link
    fedilink
    arrow-up
    14
    arrow-down
    1
    ·
    1 year 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
    link
    fedilink
    arrow-up
    7
    ·
    1 year ago

    Python is an illusion

    • essell@lemmy.world
      link
      fedilink
      arrow-up
      8
      arrow-down
      1
      ·
      1 year ago

      All the best things in life are intangible.

  • Dizzy Devil Ducky@lemm.ee
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 year 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
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 year ago

      According to PyPI, the library is genuine.

  • HStone32@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    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.

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

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.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 160 users / day
  • 522 users / week
  • 2.6K users / month
  • 8.76K users / 6 months
  • 1 local subscriber
  • 35.6K subscribers
  • 1.64K Posts
  • 29K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org