small medium large xlarge

10 Jul 2013, 05:01
Avdi Grimm (3 posts)

Reading about how Elixer hides the default accumulator of zero, the first question to pop into my head was “why a separate function instead of a default argument value?” e.g. def sum(list, total // 0) ...

It might be nice to cover the why of that here.

11 Jul 2013, 23:04
Dave Thomas (366 posts)

It’s because that would make the initialized value part of the public API. It doesn’t really belong there.