61
submitted 2 months ago by mac@programming.dev to c/python@programming.dev
you are viewing a single comment's thread
view the rest of the comments
[-] ExtremeDullard@lemmy.sdf.org 3 points 2 months ago* (last edited 2 months ago)

I just spent days and days fixing years of old code that had incorrect backslash escapes in string literals because they were upgraded from silent deprecationwarnings to very much not silent syntaxwarnings in 3.12 and I couldn't find a way to shut them up.

Yes I know incorrect string literals are bad and they should be fixed, but this was legacy, well tested code and we were fine with the silent errors. But no: Python forced me to halt what I was doing and fix shit that didn't need fixing for days, then re-release new versions of all our packages, then warn our customers, write an entry in the company's website's support page, blah blah blah... Stupid things that, ya know, take a truckload of time.

And I also had to rewrite our old installers that used to install Python modules system-wide because, again, 3.12 pip now refuses to install outside of a venv unless you use --break-system-packages, and even if you do, it bitches and moans. I didn't want to fix our old installers either, but there ya go, same thing: no way to make it revert to the old way and let old code grow old peacefully.

And I had to rewrite our Unix modules that use crypt because inexplicably, for no rational reason, it's being dropped. WHY??? Yes it's insecure, but if you need it for backward compatibility reasons, why remove it? Particularly since it's still there: all you have to do is replace it with passlib.sha512. It's no biggie, but again, when you have mountains of old code to go through, it takes time to fix it, retest it and re-release it. What's the point in making things extra-difficult gratuitously?

And before you say "All you had to do was stick to 3.11 or below", try installing 3.11 and below for all users in Win11: you can't. Our users getting new Windows machine essentially have to use Python 3.12, meaning I have to fix all our old code so stuff doesn't break or look like shit.

Sigh...

I love this language. I really do. But the Python people essentially give zero shit about backward-compatibility and every 6 months to 2 years, some small things break that become a massive pain in the rear-end to fix.

And as a result, guess what: as long as whatever version of Python I'm currently using works, I am NOT upgrading it, because I don't like to have to work overtime for nothing. And that's not great because Python users should want to get the latest and greatest instead of fearing what new things will get broken.

[-] FizzyOrange@programming.dev 6 points 2 months ago* (last edited 2 months ago)

I agree, too little regard for backwards compatibility. They also removed distutils which meant I had to fix a load of code that used it. It was bad code that shouldn't have used it even when written, but still... seems like they didn't learn their lesson from Python 2.

It's not like it would be difficult to avoid these issues either. Everyone else just makes you declare your "target version" and then the runtime keeps things compatible with that version - Android via SDK target version, Rust with its editions, hell even CMake got this right. CMake!!

[-] ExtremeDullard@lemmy.sdf.org 3 points 2 months ago

Oh yeah, I forgot about the distutils thing. Yeah, I had to fix that too. But at least it wasn't hours of wading through and retesting old code.

[-] FizzyOrange@programming.dev 2 points 2 months ago

In fairness for the invalid escape sequence thing static linters (Pylint, Pyright, etc.) should be already telling you about it.

[-] ExtremeDullard@lemmy.sdf.org 2 points 2 months ago* (last edited 2 months ago)

Yes of course. If I run pyflakes or mypy on our code, it's a complete shitshow. But that's not the point.

The point is, for better or worse, however imperfect our code is, it run cleanly and predictably in older Python interpreters. When I have to correct legacy stuff that is known to work well, I compromise hundreds of hours of formal and informal testing.

Imperfect code that has been running flawlessly for a long time and has proven its reliability is better than more perfect code that hasn't been tested as much.

In fact, in certain industries like the aero industry, it doesn't matter if you find slightly bad code after the system has been certified: it's frozen and you leave it the hell alone unless it's critical. Fortunately we're not exactly in that situation, but we do have customers who require - and pay for - configuration control, and those Python issues kind of make everything more difficult needlessly for us. Lucky for us, our Python packages are mostly support code, so it's not too critical. But we do have to be careful and thorough.

[-] FizzyOrange@programming.dev 1 points 2 months ago
load more comments (7 replies)
this post was submitted on 04 Aug 2024
61 points (100.0% liked)

Python

6297 readers
43 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS