[Python-Dev] PEP 362 Third Revision

Yury Selivanov yselivanov.ml at gmail.com
Thu Jun 14 17:05:05 CEST 2012


On 2012-06-14, at 10:50 AM, Alexandre Zani wrote:
> On Thu, Jun 14, 2012 at 6:50 AM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
>> I guess if nobody really wants to keep 'is_args', we can alter the
>> PEP.
>> 
>> Let's consider replacement of 'Parameter.is_*' set of attributes with
>> a single 'Parameter.kind' attribute, which will have the following
>> possible values: 'positional', 'vararg', 'keyword-only', 'varkwarg'.
>> 
>> (I think 'positional' is more intuitive than 'index'?)
>> 
> 
> I disagree largely for readability reasons. As the PEP stands, I can
> look at a Parameter object and immediately understand what the
> different possible values are by just listing its attributes. The kind
> attribute makes that harder.
> 
> Comparing with strings is error prone. If I do param.is_varargs
> (adding an s at the end of the attribute name) I will see an attribute
> error and know what is going on. If I do the same mistake with the
> kind attribute param.kind == "varargs", the expression will just
> always be False without any explanation.

Agree on this one, good point (although unit tests generally help to 
avoid those problems.)

-
Yury


More information about the Python-Dev mailing list