Check if there's something "waiting for" the return value of a function

The very second line of the body of import this says it all: "explicit is better than implicit". In this case, if you provide an optional argument, the code will be more obvious (and thus easier to understand), simpler, faster and safer. Keep it as a separate argument with a name like wait.

While with difficulty you could implement it magically, it would be nasty code, prone to breaking in new versions of Python and not obvious. Avoid that route; there lieth the path unto madness.


All functions return a value when they complete.

If you're asking if they should return at all, then you are actually asking about The Halting Problem

Tags:

Python