[Python-Dev] [Python-checkins] r51458 - peps/trunk/pep-0000.txt peps/trunk/pep-0362.txt

Brett Cannon brett at python.org
Tue Aug 22 19:16:01 CEST 2006


On 8/22/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
> brett.cannon wrote:
> > Added: peps/trunk/pep-0362.txt
> > +Relation With Other PEPs
> > +========================
> > +
> > +"Keyword-Only Arguments [#pep-3102]_
> > +------------------------------------
> > +
> > +If keyword-only parameters come into existence, the Parameter object
> > +will require modification.  A ``keyword_only`` attribute will be added
> > +that holds a boolean representing whether the parameter is
> > +keyword-only or not.
>
> Why an extra attribute instead of using "x.position is None"?


Didn't think of that.  =)

Unlike
> default_value, None is not otherwise a legitimate value for the position
> attribute.
>

Makes sense.  I will talk it over with Jiwon.  Might want to rename
'position' to 'positional' then in order to make it even more obvious what
the information stores.

> +Where should keyword-only parameters be stored in the Signature object?
> > +-----------------------------------------------------------------------
> > +
> > +If PEP 3102 [#pep-3102]_ ends up being accepted, there is the
> > +possibility that storing keyword-only parameters in a set instead of
> > +in the ``parameters`` attribute of the Signature object makes more
> > +sense.  Since keyword-only parameters do not have any semantic meaning
> > +in terms of their position within the signature, there is no direct
> > +semantic gain in storing it in the parameter list.
> > +
> > +Storing keyword-only paramaters in a set makes it much more explicit
> > +that keyword-only parameters have no inherent order.  It does have the
> > +drawback, though, that if one wants to process all parameters at once
> > +they would need to perform extra work to make sure to go through both
> > +the parameter list and set.
>
> Throwing the keyword arguments in a set still loses information that was
> present in the source code. Preserving the ordering in the signature
> object
> means that the author of the function can control the order in which the
> keyword arguments are displayed by introspection-based help utilities (e.g
> .
> putting "more important" arguments first.


That's a good enough argument for me.

-Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060822/dd37116f/attachment.htm 


More information about the Python-Dev mailing list