[Python-Dev] PEP 362: 4th edition

Yury Selivanov yselivanov.ml at gmail.com
Tue Jun 19 03:33:54 CEST 2012


On 2012-06-18, at 9:29 PM, Nick Coghlan wrote:

> On Tue, Jun 19, 2012 at 7:06 AM, Jim Jewett <jimjjewett at gmail.com> wrote:
>> Correct; it should be redundant.  Signature.kwargsparameter should be
>> the same object that occurs as the nth element of
>> Signature.parameters.values().  It is just more convenient to retrieve
>> the parameter directly than it is to iterate through a collection
>> inspecting each element for the value of a specific attribute.
> 
> I suspect in 3.4 we will add the following additional convenience properties:
> 
> Signature.positional -> list[Parameter]
>    List of POSITIONAL_ONLY and KEYWORD_OR_POSITIONAL parameters
> Signature.var_positional -> None or Parameter
>    Reference to the VAR_POSITIONAL parameter, if any
> Signature.keyword -> dict{name:Parameter}
>    Mapping of all KEYWORD_ONLY and KEYWORD_OR_POSITIONAL parameters
> Signature.var_keyword -> None or Parameter
>    Reference to the VAR_KEYWORD parameter, if any

Maybe.  But I'd suggest to avoid the intersection of 'Signature.positional'
and 'Signature.keyword'.  Better to have 'Signature.keywordonly'.

> However, I don't think we should add such convenience properties
> *right now*. One step at a time.

+1.  'Signature.parameters' seems to be enough right now.

-
Yury


More information about the Python-Dev mailing list