J2 proposal: keyword

R

Robert Brewer

Just to put collected wisdom in one spot for now, here's what's in my
draft:


III. Choosing a keyword

If a keyword is to be chosen over @ or other punctuation, the question
remains, "which word should it be?" Many words have been proposed, and
although we may recommend a small number here, it is more important that
we establish guidelines for the selection of a keyword. The keyword:

-Should not be used widely as an identifier in existing Python code.
-Should be easy to remember when writing new code.
-Should be easy to remember when reading existing code.
-Should be easy to search for, in both docs and Google.
-Should not be a word with a planned future. This rules out "with" and
"as" (I should probably footnote this).
-In this author's opinion (back me up here, people), it should not be a
form of the word "decorate". The term "decorate" conflicts with two
separate concepts: both the GoF Decorator pattern (which is a runtime
wrapper, not a compile-time one), and with our own beloved
"decorate-sort-undecorate" pattern (aka Schwartzian or Guttman-Rosler
Transform).

-Candidates for keywords have fallen into two or three camps, and
emphasize different aspects of decorators:

-Declarative: declare, predef, moddef
-Transformative: transform, wrap, modify, mutate
-Attributive/Annotative: amend, using, having
-Directive: pragma, signify
-Associative: helper, qualify, qual, meta
-Cross-cutting: imbue, endow, bestow, embellish, extend, accum, glom,
confer
-Prepositions/Adverbs: using, through, per, via, by


I had an ugly paragraph promoting 'declare' as a top candidate, but I've
always liked 'using' (which many of you promoted within the past 24
hours). Maybe the above will produce further polarization among you. ;)


Robert Brewer
MIS
Amor Ministries
(e-mail address removed)
 
R

Roy Smith

Robert Brewer said:
Just to put collected wisdom in one spot for now, here's what's in my
draft:


III. Choosing a keyword

If a keyword is to be chosen over @ or other punctuation, the question
remains, "which word should it be?" Many words have been proposed, and
although we may recommend a small number here, it is more important that
we establish guidelines for the selection of a keyword. The keyword:

-Should not be used widely as an identifier in existing Python code.
-Should be easy to remember when writing new code.
-Should be easy to remember when reading existing code.
-Should be easy to search for, in both docs and Google.
-Should not be a word with a planned future. This rules out "with" and
"as" (I should probably footnote this).
-In this author's opinion (back me up here, people), it should not be a
form of the word "decorate". The term "decorate" conflicts with two
separate concepts: both the GoF Decorator pattern (which is a runtime
wrapper, not a compile-time one), and with our own beloved
"decorate-sort-undecorate" pattern (aka Schwartzian or Guttman-Rosler
Transform).

Putting on my "Slightly Silly Party" hat, may I suggest that "pie" meets
all of those constraints :)
 
P

Peter Hansen

Robert said:
III. Choosing a keyword [snip good list of principles]
-Candidates for keywords have fallen into two or three camps, and
emphasize different aspects of decorators:

-Declarative: declare, predef, moddef
-Transformative: transform, wrap, modify, mutate
-Attributive/Annotative: amend, using, having
-Directive: pragma, signify
-Associative: helper, qualify, qual, meta
-Cross-cutting: imbue, endow, bestow, embellish, extend, accum, glom,
confer
-Prepositions/Adverbs: using, through, per, via, by

I had an ugly paragraph promoting 'declare' as a top candidate, but I've
always liked 'using' (which many of you promoted within the past 24
hours). Maybe the above will produce further polarization among you. ;)

+1 on "using" as the best of the choices above.

I find the declarative ones awkward, transform inappropriate when
transforming is not going on, attributive ones okay (but "amend"
sounds like it must come afterwards), directive too compiler-like,
associative not bad but too abstract, cross-cutting too much like
"decorate" not to mention sort of frivolous-sounding, and prepositions
mostly too vague (except for "using" again).

-Peter
 
A

Arthur

-Candidates for keywords have fallen into two or three camps, and
emphasize different aspects of decorators:

-Declarative: declare, predef, moddef
-Transformative: transform, wrap, modify, mutate
-Attributive/Annotative: amend, using, having
-Directive: pragma, signify
-Associative: helper, qualify, qual, meta
-Cross-cutting: imbue, endow, bestow, embellish, extend, accum, glom,
confer
-Prepositions/Adverbs: using, through, per, via, by

There is only consensus as to what any of those words would mean, in
context. Make happen:

foo=whatever(foo)

Some of us - at least one of us - find that a point with real
significance. It cannot be said better than it is being said, is the
point,

And I think it is stretching things to an extreme to imply that the
poll results reflect a concensus of the community in any direction.
There is a more fundamental lack of consensus as to whether Guido
should allow himself to be influenced by these kinds of polls.

I do not have blind faith in Guido's instincts. I do think he is in a
unique position to see the Big Picture of all the issues and forces at
work. Being at the center of the storm.

So in the end I might have ended up doing exactly what I have accused
others of doing in other cases - reading into the @decorator syntax
decision (assuming *some* syntax is a fait accompli) - finding it to
be wise, for reasons perhaps beyond its intentions.

Art
 
A

Anthony Baxter

So in the end I might have ended up doing exactly what I have accused
others of doing in other cases - reading into the @decorator syntax
decision (assuming *some* syntax is a fait accompli) - finding it to
be wise, for reasons perhaps beyond its intentions.

As someone else said at some point during the last two weeks of
decorator discussions - we're all using a language that, by and large,
is Guido's design. He's done a good job so far of producing something
that's excellent - I trust him to produce a good result here.

I hope the final decision ends up getting less vitriolic responses
than the 2.4a2 release got.
 
P

Paul Rubin

Robert Brewer said:
-Candidates for keywords have fallen into two or three camps, and
emphasize different aspects of decorators:

-Declarative: declare, predef, moddef
-Transformative: transform, wrap, modify, mutate
-Attributive/Annotative: amend, using, having
-Directive: pragma, signify
-Associative: helper, qualify, qual, meta
-Cross-cutting: imbue, endow, bestow, embellish, extend, accum, glom,
confer
-Prepositions/Adverbs: using, through, per, via, by

Not sure where these would go: prologue, preamble, preface

How about something like "def_using"?
 
A

Andrew Durdin

Certainly "using... def..." comes across very clearly to me. I think
it the best of the proposed keywords.
 
N

Nicolas Fleury

Robert said:
I had an ugly paragraph promoting 'declare' as a top candidate, but I've
always liked 'using' (which many of you promoted within the past 24
hours). Maybe the above will produce further polarization among you. ;)

+1 for using.
Nicolas
 
O

Oliver Fromme

Robert Brewer said:
> III. Choosing a keyword
> [...]
> -Candidates for keywords have fallen into two or three camps, and
> emphasize different aspects of decorators:
>
> -Declarative: declare, predef, moddef
> -Transformative: transform, wrap, modify, mutate
> -Attributive/Annotative: amend, using, having
> -Directive: pragma, signify
> -Associative: helper, qualify, qual, meta
> -Cross-cutting: imbue, endow, bestow, embellish, extend, accum, glom,
> confer
> -Prepositions/Adverbs: using, through, per, via, by

Aren't decorators just functions that are applied to the
function definition? Then how about "apply"? It's short
(for those lazy typers), and it expresses exactly what
happens.


apply:
staticmethod
memoize
def foo (int):
pass


Best regards
Oliver
 
A

Anthony Baxter

Aren't decorators just functions that are applied to the
function definition? Then how about "apply"?

It's already the name of an (now deprecated) builtin. It won't
becoming a keyword, I suspect ever.
 
P

Peter Hansen

Oliver said:
Aren't decorators just functions that are applied to the
function definition? Then how about "apply"? It's short
(for those lazy typers), and it expresses exactly what
happens.


Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on
win32<built-in function apply>


I'm fairly sure that fact alone would cause a lot of grief in one
way or the other.

-Peter
 
P

Paul McGuire

Roy Smith said:
Putting on my "Slightly Silly Party" hat, may I suggest that "pie" meets
all of those constraints :)

.... with the exception of the assumed constraint that the keyword will be a
*word*, and not some malodorous punctuation mark resembling a SNOTTY-FACED
HEAP OF PARROT DROPPINGS!!!

Oh, sorry, that was abuse...

-- Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top