[Python-Dev] A Desperate Plea For Introspection (aka: BDFAP Needed) (original) (raw)
Ethan Furman ethan at stoneleaf.us
Fri Jun 22 22:58:40 CEST 2012
- Previous message: [Python-Dev] A Desperate Plea For Introspection (aka: BDFAP Needed)
- Next message: [Python-Dev] A Desperate Plea For Introspection (aka: BDFAP Needed)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Yury Selivanov wrote:
On 2012-06-22, at 3:47 PM, Ethan Furman wrote:
Guido van Rossum wrote: On Fri, Jun 22, 2012 at 12:24 PM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
On 2012-06-22, at 3:18 PM, Guido van Rossum wrote:
On Fri, Jun 22, 2012 at 12:10 PM, Yury Selivanov <yselivanov.ml at gmail.com> wrote: Yes, I meant optional. Would 'name(arg1, *, [arg2])' be better? Hardly, because that's not valid syntax. I'd write name(arg1, *, arg2=). Like replace(*, name=, kind=, default=, annotation=) -> Parameter or replace(*, name=, kind=, default=, annotation=) -> Parameter Either one's an improvement, but you'll have to explain at the top of the PEP what you intend this notation to mean. I'd go with since the key thing here seems to be that various keywords, when not specified, mean that nothing changes. OTOH in some places you can probably write "foo=Signature.empty" (etc.). Parameter names that follow '*' in the signature are not optional (unless that has changed since 3.2). In other words, the above signature requires that name, kind, default, and annotation be specified by name and be given values when replace is called) I know. Those are optional keyword-only arguments. In the code: def replace(self, *, name=void, kind=void, annotation=void, default=void): We just need some clear convention for the PEP - and the mark should work.
That looks strange to me -- I suggest putting brackets around each one, like:
replace(*, [name=<optional>,] [kind=<optional>,]
[default=,] [annotation=]) -> Parameter
which is still a bit noisy. At the risk of raising the ire of those who don't condone the use of '...' :) how about:
replace(*, [name=...,] [kind=...,] [default=...,] [annotation=...]
) -> Parameter
Ethan
- Previous message: [Python-Dev] A Desperate Plea For Introspection (aka: BDFAP Needed)
- Next message: [Python-Dev] A Desperate Plea For Introspection (aka: BDFAP Needed)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]