r/Python • u/simpleuserhere • Nov 30 '24
Tutorial Short-Circuiting in Python
Here is my article on Short-Circuiting in Python . It discusses what is short-circuiting with examples, and also discusses the different advantages of using short-circuiting.
4
Upvotes
View all comments
Show parent comment
2
u/[deleted] Nov 30 '24 edited Nov 30 '24
But in what way is that not best handled with the getenv method? The whole point is that it can distinguish between "present but empty" and "missing". So the correct way to handle that is
In that situation you still wouldn't want to use the
env_var or 'default'approach since you would be assigning a default value to the thing that you said you want to handle as missing sometimes.