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

Ethan Furman ethan at stoneleaf.us
Fri May 20 21:22:52 CEST 2011


Masklinn wrote:
> On 2011-05-20, at 20:56 , Ethan Furman wrote:
>> Masklinn wrote:
 >>> Ethan wrote:
>>>> If the function can't proceed properly without an actual parameter, why supply
>>>> a default?
 >>>
>>> It can, where did you get the idea that it could not? That's the point of the
>>> default parameter.
 >>
>> Yes, I am aware.  And the point of providing an empty list as a default is so you have a list to add things to
 >
> Not at all, you may just want to iterate on it, or accumulate it. There are cases of exactly this in the standard library itself.

Um, isn't accumulating modifying?  Or do you mean accumulating in a 
global or class instance? And why would you iterate over an empty list? 
  If you have an example from the stdlib I'd love to see it (seriously 
-- I'm always up for learning something).

~Ethan~



More information about the Python-ideas mailing list