473,394 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Decorator keyword options

Thanks to everyone who has voted so far - please keep them coming! Lurkers,
this means you!

In the interests of saving time, I propose that an additional thread start
soon, to determine choices for a decorator keyword, in the event that our
selected syntax requires one. Please visit the PythonDecorators Wiki page,
and navigate to section 6.1 Indicators (or follow this link
http://www.python.org/moin/PythonDec...8529997f56fc9e )
(not sure how reliable this is?) I have started numbering the options in
preparation for another voting thread, if you have other proposals, please
include them on this Wiki page, along with your +/0/- commentary.

-- Paul
Jul 18 '05 #1
13 1833
Paul McGuire wrote:
Thanks to everyone who has voted so far - please keep them coming! Lurkers,
this means you!

In the interests of saving time, I propose that an additional thread start
soon, to determine choices for a decorator keyword, in the event that our
selected syntax requires one. Please visit the PythonDecorators Wiki page,
and navigate to section 6.1 Indicators (or follow this link
http://www.python.org/moin/PythonDec...8529997f56fc9e )
(not sure how reliable this is?) I have started numbering the options in
preparation for another voting thread, if you have other proposals, please
include them on this Wiki page, along with your +/0/- commentary.


Good plan. If anyone likes "wrap" they could add it to the Wiki with
something akin to the description of transform

David
Jul 18 '05 #2
"David Fraser" <da****@sjsoft.com> wrote in message
news:cg**********@ctb-nnrp2.saix.net...
Good plan. If anyone likes "wrap" they could add it to the Wiki with
something akin to the description of transform

David

David -

I encourage you to do this for yourself, if you have time. I think this is
exactly the kind of thing Wiki was intended for - we are all empowered to
include items on that list.

(If you do not see the "EditPage" option at the bottom of the page, select
the "Preferences" item on the left-side menu and enter your info. Once this
is done, you should be able to edit pages.)

-- Paul
Jul 18 '05 #3
"Paul McGuire" <pt***@austin.rr._bogus_.com> wrote in message
news:2C*****************@fe1.texas.rr.com...
(If you do not see the "EditPage" option at the bottom of the page, select
the "Preferences" item on the left-side menu and enter your info. Once this is done, you should be able to edit pages.)


Um, not sure I got that quite right. UserPreferences instructions can be
found at the top of the Wiki home page,
http://www.python.org/cgi-bin/moinmoin/FrontPage.

-- Paul
Jul 18 '05 #4
Paul McGuire wrote:
Please visit the PythonDecorators Wiki
page, and navigate to section 6.1 Indicators (or follow this link
http://www.python.org/moin/PythonDec...8529997f56fc9e )
(not sure how reliable this is?) I have started numbering the options
in preparation for another voting thread, if you have other proposals,
please include them on this Wiki page, along with your +/0/-
commentary.


A couple of comments I'd personally make...
* If you look at longer lists of decorators, what strikes me
personally is that any format is declaring properties of the
function that follows.

* It's worth considering is ability for people to search effectively
for what a piece of syntax means, especially if it's something not
likely to be heavily used by code. (Consider what happens if you
google for the phrase: to be or not to be)

For example would "properties" (not listed as an option) give any
indication that the function is being changed? "decorate" to a
greater extent does. "modifiers" or "decorators" (call a spade a
spade?) might be clearer, is just a noun.

A very useful way of dividing up decorators was posted a week or so
back, which formed the structure of section 6. Personally I think
something similar might be useful here:

* Use noun or verb
* If noun, singular or plural? (Sheep excepted)
* If verb, active or passive
* Hint at properties or actions
* Whether to link with the def or not.

"decorate" falls into the verb, passive, action category I think.
"modifiers" falls into the noun, plural, property category I think.
"using" would fall into verb, active, action, linked category

Personally I think noun, plural, property is a non-starter for most
situations (eg classmethod, staticmethod). There's probably similar
examples that work well.

Regards,
Michael.
--
Mi************@rd.bbc.co.uk
British Broadcasting Corporation, Research and Development
Kingswood Warren, Surrey KT20 6NP

This message (and any attachments) may contain personal views
which are not the views of the BBC unless specifically stated.
Jul 18 '05 #5
Paul McGuire wrote:
"David Fraser" <da****@sjsoft.com> wrote in message
news:cg**********@ctb-nnrp2.saix.net...
Good plan. If anyone likes "wrap" they could add it to the Wiki with
something akin to the description of transform

David


David -

I encourage you to do this for yourself, if you have time. I think this is
exactly the kind of thing Wiki was intended for - we are all empowered to
include items on that list.

(If you do not see the "EditPage" option at the bottom of the page, select
the "Preferences" item on the left-side menu and enter your info. Once this
is done, you should be able to edit pages.)

OK you were right I was avoiding registering :-) ... done now

David
Jul 18 '05 #6
One impression I've gotten from this whole endeavor (even going back to
Kevin Smith's python-dev e-mail thread titled "PEP 318: Can't we all just
get along?") is that what started out as a desire to simplify the
designation of some methods as "class-level" or "static" or "special" in
some way, has gotten muddied with the implementation as it got represented
with the classmethod and staticmethod decorators, and then mutating to
accommodate all types of modifier/decorator/mutators, for resource locking,
debugging, logging, memoizing, etc.

Similarly, I feel our fixation on the "decorator" concept is confounded by
our own understanding that the entries in a list of decorators such as:

keyword:
memoize
synchronize
staticmethod
def foo:
pass

will translate to:
foo = staticmethod(synchronize(memoize(foo)))

in the current vernacular.

But should we consider this implementation detail when coming up with this
name? I'd prefer to think of the associations that exist between the
concepts of 'memoize' et al. with 'foo', and use a keyword that describes
those relationships. And try to do this independent of implementation, or
coincidence with a GoF archetype.

So I have been looking at some alternatives, such as
helper:
amend:
modify:
qualify: (or perhaps qual:)
property: (or perhaps prop:)

On an alternative path, does this have to be a real word? I confess that
"qual" strikes me in an interesting way, in that it could be thought to
represent either "qualifier" or "quality", and yet is neither. Or if
"lambda" is used, why not some other Greek letter, such as "mu" or "sigma".

Still, I would like to avoid arbitrary words, as they are little better than
'@' - I'd say that something like "gerbil" should be right out! :)

This clearly represents some "thinking out loud". Throw rocks or
suggestions at will.

-- Paul
Jul 18 '05 #7
Paul McGuire wrote:
....
Similarly, I feel our fixation on the "decorator" concept is
confounded by our own understanding that the entries in a list of
decorators such as: .... [ short list ] ... will translate to:
foo = staticmethod(synchronize(memoize(foo)))

in the current vernacular.

But should we consider this implementation detail when coming up with
this name?
Since they're a list of functions that will be applied to the
function/method that follows, I personally think it's important.

Whilst many decorators can be alluded to as a keyword, I don't think all
decorators would be. Consider how you would describe the actions of
this list, or how you would describe this list of actions: (taken from
various sources)

staticmethod
generator
grammarrule('statement : expression')
versioninfo("Added in 2.4")
deprecated
typeinfo(None)
author("joe bloggs")
funcattrs(grammar="'@' dotted_name [ '(' [arglist] ')' ]",
status="experimental", author="BDFL")
qualify: (or perhaps qual:)
property: (or perhaps prop:)
On an alternative path, does this have to be a real word? I confess
that "qual" strikes me in an interesting way, in that it could be
thought to represent either "qualifier" or "quality", and yet is
neither.
Personally I'd prefer a full word, but neither def or elif are full
words, so I doubt it _has_ to be, but I'd prefer something relevant to
what is happening behind the scenes rather than something ambiguous :)
Or if "lambda" is used, why not some other Greek letter, such as "mu"
or "sigma".
Because they're not really meaningful beyond a small number of people?
This clearly represents some "thinking out loud".


Ditto.

One other thing that jumped out at me is that different syntaxes
probably work better using different keywords. (Partly why I've snipped
decorator syntaxes)
Michael.
--
Mi************@rd.bbc.co.uk
British Broadcasting Corporation, Research and Development
Kingswood Warren, Surrey KT20 6NP

This message (and any attachments) may contain personal views
which are not the views of the BBC unless specifically stated.
Jul 18 '05 #8
Michael Sparks <michaels <at> rd.bbc.co.uk> writes:
One other thing that jumped out at me is that different syntaxes
probably work better using different keywords. (Partly why I've snipped
decorator syntaxes)


Yeah, I noticed that pretty quickly too. It looks though, that, of the
suggestions requiring a keyword, only the J syntaxes are getting substantial
support. If it seems reasonable to others here, I think we should assume that
when we're discussing keyword options here, we're aiming at keywords for the J
syntaxes (and most probably J2).

Steve
Jul 18 '05 #9
Michael Sparks:
Whilst many decorators can be alluded to as a keyword, I don't think all
decorators would be. Consider how you would describe the actions of
this list, or how you would describe this list of actions: (taken from
various sources)

staticmethod
generator
grammarrule('statement : expression')
versioninfo("Added in 2.4")
deprecated
typeinfo(None)
author("joe bloggs")
funcattrs(grammar="'@' dotted_name [ '(' [arglist] ')' ]",
status="experimental", author="BDFL")


Declarations?

declare:
staticmethod
versioninfo("Added in 2.4")
deprecated
def cheeseSketch():

Neil

Jul 18 '05 #10
Some other ideas:

imbue
endow
bestow
embellish
extend
accum
glom
confer

Jul 18 '05 #11
On Fri, Aug 20, 2004 at 10:34:30PM +0000, Paul McGuire wrote:
Some other ideas:

imbue
endow
bestow
embellish
extend
accum
glom
confer


why not 'pies', and then everybody's happy?

--
John Lenton (jo**@grulic.org.ar) -- Random fortune:
Don't relax! It's only your tension that's holding you together.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBJ4yigPqu395ykGsRApt9AJwIfQ8tJKyMOZjjv+4bGg +wSTvpXQCfdJhu
eaa01Oz5TbVlti0E8qRadP0=
=E9zF
-----END PGP SIGNATURE-----

Jul 18 '05 #12
Steven Bethard <st************@gmail.com> wrote:
Michael Sparks <michaels <at> rd.bbc.co.uk> writes:
One other thing that jumped out at me is that different syntaxes
probably work better using different keywords. (Partly why I've snipped
decorator syntaxes)


Yeah, I noticed that pretty quickly too. It looks though, that, of the
suggestions requiring a keyword, only the J syntaxes are getting substantial
support. If it seems reasonable to others here, I think we should assume that
when we're discussing keyword options here, we're aiming at keywords
for the J syntaxes (and most probably J2).


I liked 'as:' for J2, but since that's earmarked...

with, using, having, applying, declare

martin
Jul 18 '05 #13
[Paul McGuire]
Thanks to everyone who has voted so far - please keep them coming! Lurkers,
this means you!


OK! Here is my vote:

J2 J2 J2

It might look like not much nuanced, but the nuances I had disappeared
after the reduction of plausible winners, as shown with the current
tallies. My vote is merely to strengthen statistics a little more. :-)

--
François Pinard http://www.iro.umontreal.ca/~pinard
Jul 18 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Sandy Norton | last post by:
If we are going to be stuck with @decorators for 2.4, then how about using blocks and indentation to elminate repetition and increase readability: Example 1 --------- class Klass: def...
3
by: Steven Bethard | last post by:
I mentioned in a previous post that I'd much prefer some sort of keyword as a decorator indication than a character like @ (or the recently suggested |). A promising note on python-dev: ...
24
by: Steven Bethard | last post by:
I think one of the biggest reasons we're having such problems coming to any agreement on decorator syntax is that each proposal makes a number of syntax decisions, not just one. For decorators, I...
11
by: Ville Vainio | last post by:
It might just be that @decorator might not be all that bad. When you look at code that uses it it's not that ugly after all. A lot of the furor about this is probably because it happened so...
7
by: Steven Bethard | last post by:
So here's the state of the decorator debate as I see it: *** Location GvR pretty strongly wants decorators before the function: ...
41
by: John Marshall | last post by:
How about the following, which I am almost positive has not been suggested: ----- class Klass: def __init__(self, name): self.name = name deco meth0: staticmethod def meth0(x):
17
by: Doug Holton | last post by:
George W Bush, as certified by Florida's election commission. Which decorator syntax do you like the most? See http://wiki.wxpython.org/index.cgi/PythonDecoratorsPoll A. @classmethod def...
7
by: Peter Otten | last post by:
I'm sure they have been mentioned somewhere but here are some more advantages of a decorator keyword (I use "transform"): - The docstring can be moved to the top of the decorator suite. - Simple...
12
by: Steven Bethard | last post by:
The poll, as stated, asked voters to vote for the syntax suggestion they liked the /most/. Some of the conclusions people are trying to draw from it are what syntaxes people liked the /least/. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.