473,560 Members | 2,937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 PythonDecorator s 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 1849
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 PythonDecorator s 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 "Preference s" 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.r r._bogus_.com> wrote in message
news:2C******** *********@fe1.t exas.rr.com...
(If you do not see the "EditPage" option at the bottom of the page, select
the "Preference s" 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 PythonDecorator s 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 "Preference s" 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(sy nchronize(memoi ze(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(sy nchronize(memoi ze(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('st atement : expression')
versioninfo("Ad ded in 2.4")
deprecated
typeinfo(None)
author("joe bloggs")
funcattrs(gramm ar="'@' dotted_name [ '(' [arglist] ')' ]",
status="experim ental", 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('st atement : expression')
versioninfo("Ad ded in 2.4")
deprecated
typeinfo(None)
author("joe bloggs")
funcattrs(gramm ar="'@' dotted_name [ '(' [arglist] ')' ]",
status="experim ental", author="BDFL")


Declarations?

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

Neil

Jul 18 '05 #10

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

Similar topics

14
2291
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 __init__(self, name):
3
1331
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: http://mail.python.org/pipermail/python-dev/2004-August/047001.html > Perhaps this could be addressed by requiring "from __future__ import > decorators",...
24
2035
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 see the following decisions that must be made: 1) Indicator Proposals differ on how some sort of indicator of "decoratorhood" is use. These...
11
1618
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 quicly. The situation might have been different if we had seen a pronouncement a week before, in the vein of "I have chosen this syntax - it will go in...
7
1576
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: http://mail.python.org/pipermail/python-dev/2004-August/047112.html http://mail.python.org/pipermail/python-dev/2004-August/047279.html
41
2826
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
1971
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 foo(): (82) 14% C1. def foo() : (235) 41% E1. def foo(): @classmethod (260) 45% Total Votes: 577
7
1521
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 attributes that don't affect the function's operation directly can be written in the "natural" name = value form. - Though I expect them to be rare...
12
1524
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/. This is probably not the right conclusion to be drawing from the poll that was given. It is, however, the kind of conclusion I think we'd like to...
0
7632
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7552
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7841
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8066
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7596
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
3605
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2047
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.