• Overarch3784@kbin.social
    link
    fedilink
    arrow-up
    24
    ·
    1 year ago

    I think the biggest problem would be libraries which are not available in 3.x. I just rewrote a python script some time ago and the syntax changes were pretty easy to change with search and replace.

    • Dr Cog@mander.xyz
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      I don’t see a problem. For one, it’s been 15 years: the vast majority of libraries have been ported by now. And like you said, you can fix the syntax with basically a find/replace script, so any stragglers can be modified easily.

      There really isn’t any excuse to still be using Python 2 anymore

      • Alphare@lemmy.world
        link
        fedilink
        arrow-up
        4
        ·
        1 year ago

        While I agree that people should have moved on for a while, the idea that porting Python 2 to 3 only involves “find and replace” or a tool like 2to3 is only true in the most trivial cases. Anything that touches bytes, unicode, network or files to do anything remotely involved needs a lot more care. I should know, our codebase still suffers from the occasional bug due to this, even though it’s been years.

  • beautiful_boater [he/him, any]@hexbear.net
    link
    fedilink
    English
    arrow-up
    16
    ·
    1 year ago

    Well, TBF there is a lot of avenues to get locked into legacy software in python. I am still modifying and using Python2 code because the drivers and libraries for hardware are only available in python2 and the hardware developers wont spend the money and time to create Python3 libraries. So I am stuck using an airbridged, un-updated python2 environment until it gets to the point of updating/backwards engineering python3 drivers and libraries for all our hardware ourselves.

    • icedterminal@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      ·
      1 year ago

      Both. There are many breaking changes that can make your code completely incompatible. Some people won’t bother to port their code. Others could be using an obscure or niche library that hasn’t been updated for 3 and can’t port their code.

      • Kogasa@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        1 year ago

        Third category, software provided as part of an ancient service contract that nobody is allowed to touch, even though the service partner stopped offering support for this particular software years ago. Ask me how I know

    • dallen@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      At the old job I was using IronPython (2.7) to write Grasshopper plug-ins in the Rhino CAD software. Luckily, it was mostly responsible for kicking off Python3 and Go subprocesses.

      Now, the worst I’m stuck with is 3.8 for one of our repos using PyTorch.

  • ALERT@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    8
    arrow-down
    1
    ·
    1 year ago

    yeah. my pain exactly. the only thing that keeps me well is 3.12 in my personal projects.

  • rockSlayer@lemmy.world
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    1 year ago

    At this point Python 2.7 should be forked into a new language. They could call it something like Daudin, after the person who coined the word Python for the genus of nonvenomous snakes

  • Gamma@beehaw.org
    link
    fedilink
    English
    arrow-up
    6
    ·
    1 year ago

    I had no idea, never having to deal with library updates must be nice 😆

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

        Meh. I’ve ported a fair many py2 projects to 3. At this point just bite the bullet. Even from a security standpoint. Trying to not let my bias seep through - but it’s been so long.

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

          Ever worked on a giant corporate codebase? I’m not saying you’re wrong, but corporate internals often work counter to common sense or sanity. You’ll have a giant mess of code, that would require months of work to port. The longer you wait, the more expensive it will get, but if you just wait long enough, it might not be the current manager’s problem anymore. So it will be postponed and postponed.

          I’ve seen this in real life a few times. EOL driven development. You just wait until it’s absolutely impossible not to upgrade, then you hastily stop everything, do the porting in a marathon of sadness that basically rewrites everything, and if you’re done, you can wait for the next EOL.

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

            The trick is to assign someone the responsibility of the upgrade and give them the authority to tell the other developers how their newly added code shall look like. This will get you there eventually.

            Seen it work on a >1 million SLOC project.

            • bane_killgrind@kbin.social
              link
              fedilink
              arrow-up
              6
              ·
              1 year ago

              Yeah but that requires good planning and better team structure.

              That’s low margin and therefore doesn’t happen often enough.

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

              This will get you there eventually.

              Only if you can actually upgrade piece by piece. In a monolith, you often enough can’t just upgrade new lines/methods. In those cases, it’s halt all development, pull everyone into upgrading and then continue.

    • o11c@programming.dev
      link
      fedilink
      arrow-up
      2
      arrow-down
      3
      ·
      1 year ago

      Python 2 had one mostly-working str class, and a mostly-broken unicode class.

      Python 3, for some reason, got rid of the one that mostly worked, leaving no replacement. The closest you can get is to spam surrogateescape everywhere, which is both incorrect and has significant performance cost - and that still leaves several APIs unavailable.

      Simply removing str indexing would’ve fixed the common user mistake if that was really desirable. It’s not like unicode indexing is meaningful either, and now large amounts of historical data can no longer be accessed from Python.

        • o11c@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          It’s because unicode was really broken, and a lot of the obvious breakage was when people mixed the two. So they did fix some of the obvious breakage, but they left a lot of the subtle breakage (in addition to breaking a lot of existing correct code, and introducing a completely nonsensical bytes class).