c/python · by norambna@programming.dev · 1yProfiling slow imports in Python https://jackevans.bearblog.dev/profiling-slow-imports-in-python/via https://fosstodon.org/@JackEvans/114055030506049316 13 points · 6 comments · view on lemmy.world
6 Comments
logging_strict@programming.dev · 1 pts · 1y
The sample code for lazy imports looks wrong
STRIPEis 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.
MajinBlayze@lemmy.world · 3 pts · 1y
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.
logging_strict@programming.dev · 1 pts · 1y
Multiple return statements is unusual. In very rare situations i understand. But the rule is never do that.
When there is only one return statement, can step into the function to see the local variables
logging_strict@programming.dev · 1 pts · 1y
You are in for a real treat!
Here is how to step in and get the locals
This technique depends on there being only one return statement
https://logging-strict.readthedocs.io/en/stable/code/tech_niques/context_locals.html
wewbull@feddit.uk · 0 pts · 1y
Why is the image on this story a paedobear?
norambna@programming.dev · 4 pts · 1y
LOL! It's a blogging platform called Bear Blog: https://bearblog.dev/