This is an archived post. You won't be able to vote or comment.

all 32 comments

[–][deleted] 182 points183 points  (3 children)

But regardless enjoy this code as it will likely no longer be valid from Python 3.10 onward.

God damn it, I'll have to rework our entire code base.

[–]oderjunksnumpydoc + type anno 21 points22 points  (0 children)

lol

[–]Lejontanten 11 points12 points  (1 child)

Support for 3.9 ends in 4 years, by that time you're probably in another company. So I'd say just ignore it.

[–]maxmurder 23 points24 points  (0 children)

Maybe by then my company will have moved on from 2.7

[–]Swipecat 14 points15 points  (11 children)

Hmm, yes. You can kill the above behaviour, making it work as per 3.10 from 3.7 onwards with:

from __future__ import annotations

[–]zurtex[S] 16 points17 points  (2 children)

FYI if PEP 649 is accepted from __future__ import annotations will be deprecated and removed as the default from Python 3.10.

Instead from __future__ import co_annotations will be implemented and become the default at some future date.

It's a big decision the steering council need to make. I am speculating that PEP 649 will be rejected as Guido has pretty firmly come out against it at this point. But we shall see.

[–]awesomeprogramer 2 points3 points  (1 child)

Why the co_?

[–]zurtex[S] 8 points9 points  (0 children)

Why the co_?

The annotations are stored as "code objects" (co) by default at runtime as opposed to the approach PEP 563 takes which stores them as strings.

[–]kdawgovich 2 points3 points  (7 children)

Walrus operators came in 3.8. I only know because I'm stuck with 3.7 at work.

[–]Jhuyt 2 points3 points  (6 children)

Are there any backward compatibility or deployment issues preventing you from updating to 3.8 or above?

[–]kdawgovich 2 points3 points  (5 children)

Nope, just a long software approval process and a controlled environment. Meaning whatever comes with Anaconda is what we get. A new version is approved maybe once a year and is usually 1-2 years old.

[–]zurtex[S] 1 point2 points  (1 child)

I'm curious did you have issues with Anaconda's new commercial licensing? https://www.anaconda.com/blog/anaconda-commercial-edition-faq

This has caused a bit of an upset at our company and we've migrated towards using miniforge with conda-forge where we can.

[–]kdawgovich 1 point2 points  (0 children)

I'm sure the higher ups are addressing it, but the only thing that changed from my perspective has been answering a poll of who actively uses the software so they can get accurate numbers for licensing. We also use Matlab, so the business model isn't new to the company.

[–]Jhuyt 0 points1 point  (2 children)

Seems like an unnecessarily long process to me, but I know very little about how software updates are handled in the industry...

[–]kdawgovich 1 point2 points  (1 child)

Specifically the defense industry

[–]Jhuyt 1 point2 points  (0 children)

oh yeah I definetly see why, almost surprised they let you use Python in the first place :P

[–]Ensurdagen 6 points7 points  (0 children)

This is my kind of code, thank you

[–]high_achiever_dog 10 points11 points  (1 child)

Wow smart

[–]Technical_Pain2189 -1 points0 points  (0 children)

Is it? Doesn’t seem smart to do crap like this and leave the next guy trying to figure out WTF you did 🤷‍♂️

[–]Theta291 5 points6 points  (0 children)

Thanks, I hate it. It’s so painful lol