What is a function parameter =[] for?
Ian Kelly
ian.g.kelly at gmail.com
Fri Nov 20 11:29:41 EST 2015
On Fri, Nov 20, 2015 at 9:24 AM, Chris Angelico <rosuav at gmail.com> wrote:
> The cases where that's not true are usually ones that are more like
> C++ overloaded functions:
>
> def next(iter):
> return iter.__next__()
> def next(iter, default):
> try: return iter.__next__()
> except StopIteration: return default
IMO the version with the default argument should have a different
name, as it is conceptually a different function.
More information about the Python-list
mailing list