Is a function returning different number of elements depending on one input parameter considered bad practice?
<p>I have a function that treats and returns data, but according to a boolean input parameter, should do a slightly different treatment (not different enough to justify a new function, I think). This slightly different treatment also requires the returning of an additional parameter. </p>

<p>Let's say I have this.</p>

<pre><code>def func(data, special_case = False):
    #Do treatment
    ...

    if special_case:
        #do some more stuff
        ...

    #return results
    if special_case:
        return results, extra_results
    else:
        return results
</code></pre>

<p>Is that considered clean? Or maybe I should always return the second variable, but just make it empty when I'm not treating the special case?</p>

<pre><code>    #return results
    if special_case:
        extra_results = something
    else:
        extra_results = []
    return results, extra_results
</code></pre>
