What is a function parameter =[] for?

Antoon Pardon antoon.pardon at rece.vub.ac.be
Tue Nov 24 09:34:15 EST 2015


Op 20-11-15 om 13:12 schreef Ned Batchelder:
> On Friday, November 20, 2015 at 6:59:54 AM UTC-5, BartC wrote:
>> On 20/11/2015 01:05, Steven D'Aprano wrote:
>>> On Fri, 20 Nov 2015 04:30 am, BartC wrote:
>>>
>>>> On 19/11/2015 16:01, Steven D'Aprano wrote:
>>> [...]
>>>
>>>> The whole concept of 'mutable' default is alien to me. A default is just
>>>> a convenient device to avoid having to write:
>>>>
>>>>     fn(0) or fn("") or fn([])
>>>
>>> Says who?
>>
>> People who want to avoid having to write:
>>
>>       fn(0) or fn("") or fn([])
> 
> I think we all understand by now that you are unhappy with what happens
> in Python with mutable defaults.  We get it.  You are not alone. Lots of
> people are surprised by this.  But it is how Python works.

May be you should get this message through to the python tribe, so that
they stop reacting as a stung horse each time someone finds something
bizarre with the language.

> I'm not sure what your goal is at this point.  Are you:
> 
>   1) still unsure what the behavior is, or 
>   2) trying to understand why it behaves that way, or
>   3) hoping to change Python, or
>   4) trying to convince us that your language is better, or
>   5) something else?

Maybe just have us recognize that some aspects of python indeed are bizarre.
That there is nothing wrong with him thinking so. After that he will have
to make up his mind whether this bizarre aspect is to big a hurdle for
using the language or not, because it seems unlikely to change.

-- 
Antoon.



More information about the Python-list mailing list