Remove Open Issue of whether keyword-only parameters should be kept in a

separate set instead of the 'parameters' attribute on Signature objects.

Also strengthen the argument for keeping keyword_only as an attribute instead
of setting position to None to flag this state.
This commit is contained in:
Brett Cannon 2006-08-22 17:30:16 +00:00
parent 51693509e1
commit 27ea465466
1 changed files with 7 additions and 20 deletions

View File

@ -112,9 +112,13 @@ will require modification. A ``keyword_only`` attribute will be added
that holds a boolean representing whether the parameter is
keyword-only or not.
As to whether the keyword-only parameters should be stored in the
``parameters`` attribute of a Signature object or in a set is
discussed in `Open Issues`_.
Nick Coghlan suggested to set 'position' to None to signal that the
argument is keyword-only and thus remove the need for the new
attribute. But that would cause different types to be used in the
attribute that are in no way compatible. It also removes the ability
to know the position number within the signature from the Paramter
object itself. Plus Guido preferred the original approach over this
alternative.
Open Issues
@ -131,23 +135,6 @@ generate the Signature object and store it to ``__signature__`` if
needed, and then return the value of ``__signature__``.
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.
References
==========