steve+comp.lang.python at pearwood.info
Thu Jun 2 01:20:18 EDT 2016
On Thursday 02 June 2016 14:21, Igor Korot wrote:
> Hi, guys,
> On Wed, Jun 1, 2016 at 9:42 PM, boB Stepp <robertvstepp at gmail.com> wrote:
>> On Wed, Jun 1, 2016 at 7:55 PM, Marcin Rak <mrak at sightlineinnovation.com>
>>> Hi to all
>>> I have a beginner question to which I have not found an answer I was able
>>> to understand. Could someone explain why the following program:
>>> def f(a, L=):
>>> return L
>>> gives us the following result:
>>> How can this be, if we never catch the returned L when we call it, and we
>>> never pass it on back to f???
> I think the OP question here is:
> Why it is printing the array?
Because he calls the function, then prints the return result.
calls f(1), which returns , then prints .
Then he calls:
which returns [1, 2] (but he expects ), then prints it. And so on.
> There is no line like:
> t = f(1)
> print t
Correct. But there are lines:
More information about the Python-list