[Python-Dev] PEP 362 minor nits (original) (raw)
Jim Jewett jimjjewett at gmail.com
Tue Jun 19 22:17:46 CEST 2012
- Previous message: [Python-Dev] PEP 362 minor nits
- Next message: [Python-Dev] PEP 362 minor nits
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Jun 19, 2012 at 2:10 PM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
On 2012-06-19, at 12:33 PM, Jim Jewett wrote:
On Tue, Jun 19, 2012 at 11:53 AM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
Based on: http://hg.python.org/peps/file/tip/pep-0362.txt view pep-0362.txt @ 4466:659639095ace ================== 142 * args : tuple 143 Tuple of positional arguments values. Dynamically computed from 144 the 'arguments' attribute. 145 * kwargs : dict 146 Dict of keyword arguments values. Dynamically computed from 147 the 'arguments' attribute.
Correct, we push as much as possible to 'args'.
[examples to clarify]
OK, I would just add a sentence and commented example then, something like.
Arguments which could be passed as part of either *args or **kwargs will be included only in the args attribute. In the following example:
>>> def g(a=1, b=2, c=3): pass
>>> s=signature(g)
>>> ba=s.bind(a=10, c=13)
>>> ba.args
(10,)
>>> ba.kwargs
{'c': 13}
Parameter a is part of args, because it can be.
Parameter c must be passed as a keyword, because (earlier) parameter b is not being passed an explicit value.
I can tweak the PEP to make it more clear for those who don't know that staticmethods are not exactly methods, but do we really need that?
I would prefer it, if only because it surprised me. When do distinguish between methods, staticmethod isn't usually the odd man out.
And I also agree that the implementation doesn't need to change (except to add a comment), only the PEP.
-jJ
- Previous message: [Python-Dev] PEP 362 minor nits
- Next message: [Python-Dev] PEP 362 minor nits
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]