[Python-Dev] PEP 362 Third Revision (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Fri Jun 15 05:21:20 CEST 2012
- Previous message: [Python-Dev] PEP 362 Third Revision
- Next message: [Python-Dev] PEP 362 Third Revision
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jun 15, 2012 at 11:37 AM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
On 2012-06-14, at 7:16 PM, Nick Coghlan wrote:
POSITIONALONLY POSITIONALORKEYWORD VARPOSITIONAL KEYWORDONLY VARKEYWORD I like those. A bit too lengthy and verbose, but the names are consistent.
In this case, I'm willing to trade a bit of verbosity for accuracy. It also suggests a possible, more explicit name for the attribute: "binding".
Parameter.binding - describes how argument values are bound to the parameter
POSITIONAL_ONLY - value must be supplied as a positional argument [1]
POSITIONAL_OR_KEYWORD - value may be supplied as either a keyword
or positional argument [2] KEYWORD_ONLY - value must be supplied as a keyword argument [3] VAR_POSITIONAL - a tuple of positional arguments that aren't bound to any other parameter [4] VAR_KEYWORD - a dict of keyword arguments that aren't bound to any other parameter [5]
[1] Python has no explicit syntax for defining positional only
parameters, but they may be implemented by processing the contents of a VAR_POSITIONAL parameter and customising the contents of signature. Many builtin and extension module functions (especially those that accept only one or two parameters) accept positional-only parameters. [2] This is the standard binding behaviour for functions implemented in Python [3] Keyword only parameters are those which appear after a "*" or "*args" entry in a Python function definition. They may also be implemented by processing the contents of a VAR_KEYWORD parameter and customising the contents of signature. [4] This corresponds to a "*args" parameter in a Python function definition [5] This corresponds to a "**kwds" parameter in a Python function definition
Cheers, Nick.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message: [Python-Dev] PEP 362 Third Revision
- Next message: [Python-Dev] PEP 362 Third Revision
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]