Function with multiple options of returns
<p>Sorry, if this question was already answered, I couldn't think of a better way to describe this problem :/</p>

<p>Let's say I have a function like this:</p>

<pre><code>def func(arg):
    if arg something:
        return a, b, c, d
    else:
        return False
</code></pre>

<p>So, when i call this function like this:</p>

<pre><code>a, b, c, d = func(arg)
</code></pre>

<p>and it happens, that the function only returns False -would this create a problem (since I'm assigning 4 variables but only getting 1 bool) ? </p>

<p>How about instead of having mixed return types, just refactor to require the function to have a truthy argument and raise an Error otherwise? This way the Error will be raised inside the function and not on assignment, which seems clearer to me.</p>

<pre><code>def func(arg):
    if not arg:
        raise ValueError('func requires a truthy argument')
    return a, b, c, d
</code></pre>

python function return