You must log in or register to comment.
Why is the image on this story a paedobear?
LOL! It’s a blogging platform called Bear Blog: https://bearblog.dev/
The sample code for lazy imports looks wrong
STRIPE = None def _stripe(): global STRIPE if STRIPE is None: import stripe return stripe return STRIPE
STRIPE
is never changed. And two return statements in the same function?!Anyways can imagine how to do lazy imports without relying on the given code sample.
This is a function definition, not where it’s called; any number of things can happen between these statements running. Second, multiple return statements is not unusual when there is control logic, i.e. if statements.