this post was submitted on 23 Feb 2025
16 points (100.0% liked)

Python

6723 readers
1 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 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 3 points 1 week ago (2 children)

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 1 points 5 days ago

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

[–] logging_strict 1 points 5 days ago

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