What is a function parameter =[] for?

Michael Torrie torriem at gmail.com
Thu Nov 19 17:55:50 EST 2015


On 11/19/2015 02:21 PM, BartC wrote:
> (Python returns 42; so that means my languages are more dynamic than 
> Python? That's hard to believe!)

It tells me your language does late binding for default arguments, which
does mean the default argument can dynamically change at call time,
which would surprise me if I didn't know about it.  Either form of
binding is acceptable, and I don't think it makes a language more or
less dynamic.  Of course as Chris and Laura have said, a list as a
default parameter throws people off because of the semantics of
mutability, and the fact that Python's variable model does not follow
the traditional memory box model used in compiled languages like C.




More information about the Python-list mailing list