• Björn Tantau@swg-empire.de
      link
      fedilink
      arrow-up
      166
      arrow-down
      5
      ·
      7 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
        link
        fedilink
        arrow-up
        147
        arrow-down
        1
        ·
        7 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
          link
          fedilink
          arrow-up
          43
          arrow-down
          2
          ·
          7 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.

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

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

      • Otter@lemmy.ca
        link
        fedilink
        English
        arrow-up
        30
        ·
        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

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      42
      arrow-down
      4
      ·
      edit-2
      7 months ago

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

    • Adel Khial@lemmy.world
      link
      fedilink
      arrow-up
      32
      ·
      7 months ago

      It’s funny because

      from apps import facebook-killer as fb
      
      fb.start()
      
      // 3 million seed investment 
      
      
    • Lupec@lemm.ee
      link
      fedilink
      arrow-up
      5
      ·
      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

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

    Hahaha now code-golf it. One line FTW!

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

  • adr1an@programming.dev
    link
    fedilink
    arrow-up
    60
    arrow-down
    2
    ·
    7 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
    link
    fedilink
    arrow-up
    32
    ·
    edit-2
    7 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”.

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

  • j4k3@lemmy.world
    link
    fedilink
    arrow-up
    14
    arrow-down
    1
    ·
    7 months ago

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

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

  • HStone32@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    7 months 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.