[Python-ideas] function defaults and an empty() builtin

Greg Ewing greg.ewing at canterbury.ac.nz
Sat May 21 05:57:30 CEST 2011


Masklinn wrote:

> Again, this default parameter is for functions which *are not supposed to* modify
> collections they were provided as parameters (which is the vast majority of functions,
> really).

Your empty() default would do nothing to catch attempts to
modify a passed-in list. If you're worried about the function
erroneously modifying the default value, you should be just as
worried about that.

-- 
Greg



More information about the Python-ideas mailing list