Re: [Python-Dev] PEP 362 minor nits

2012年6月19日 13:20:12 -0700

On Tue, Jun 19, 2012 at 2:10 PM, Yury Selivanov <[email protected]> wrote:
> On 2012年06月19日, at 12:33 PM, Jim Jewett wrote:
>
>> On Tue, Jun 19, 2012 at 11:53 AM, Yury Selivanov
>> <[email protected]> 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
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to