Something in the function tutorial confused me.

Neil Cerutti horpner at yahoo.com
Mon Aug 6 07:27:28 EDT 2007


On 2007-08-06, Neil Cerutti <horpner at yahoo.com> wrote:
> On 2007-08-06, Lee Fleming <countblabula at yahoo.com> wrote:
>> def  f(x, y=None):
>>     if y is None: y = []
>>     y.append(x)
>>     return y
>
> >>> f(f(23))
>  [23, 42]

Sorry. That should've been:

  >>> f(42, f(23))
  [23, 42]

-- 
Neil Cerutti
Scouts are saving aluminum cans, bottles, and other items to be recycled.
Proceeds will be used to cripple children. --Church Bulletin Blooper



More information about the Python-list mailing list