[Python-Dev] [Python-checkins] cpython (2.7): #14804: Remove [] around optional arguments with default values
Nick Coghlan
ncoghlan at gmail.com
Tue May 22 14:08:50 CEST 2012
More information about the Python-Dev mailing list
Tue May 22 14:08:50 CEST 2012
- Previous message: [Python-Dev] Volunteering to be PEP czar for PEP 421, sys.implementation
- Next message: [Python-Dev] [Python-checkins] cpython (2.7): #14804: Remove [] around optional arguments with default values
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, May 22, 2012 at 6:34 PM, hynek.schlawack <python-checkins at python.org> wrote: > http://hg.python.org/cpython/rev/a36666c52115 > changeset: 77102:a36666c52115 > branch: 2.7 > parent: 77099:c13066f752a8 > user: Hynek Schlawack <hs at ox.cx> > date: Tue May 22 10:27:40 2012 +0200 > summary: > #14804: Remove [] around optional arguments with default values > > Mostly just mechanical removal of []. In some rare cases I've pulled the > default value up into the argument list. Be a little careful with this - "[]" is the right notation when the function doesn't support keyword arguments. At least one of the updated signatures is incorrect: > diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst > --- a/Doc/library/itertools.rst > +++ b/Doc/library/itertools.rst > @@ -627,7 +627,7 @@ > break > > > -.. function:: tee(iterable[, n=2]) > +.. function:: tee(iterable, n=2) >>> itertools.tee([], n=2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: tee() takes no keyword arguments Since calling "tee(itr, n=2)" doesn't add really any clarity over "tee(itr, 2)", it's unlikely this function will ever gain keyword argument support (since supporting keyword arguments *is* slower than supporting only positional arguments for functions written in C. The change is probably valid for the pure Python modules, and the builtins looked right, but be wary of any extension modules in the list. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message: [Python-Dev] Volunteering to be PEP czar for PEP 421, sys.implementation
- Next message: [Python-Dev] [Python-checkins] cpython (2.7): #14804: Remove [] around optional arguments with default values
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list