473,386 Members | 1,598 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,386 software developers and data experts.

wiki update: decorator syntax breakdown

Just wanted to let everyone know that I went through the wiki and
tried to consolidate some of the advantages/disadvantages of the
various syntax decisions:

http://www.python.org/cgi-bin/moinmoin/PythonDecorators (section 7)

Hopefully I've extracted most of the important points from the various
example syntaxes.

Steve
Jul 18 '05 #1
3 1296
Steven Bethard wrote:
Just wanted to let everyone know that I went through the wiki and
tried to consolidate some of the advantages/disadvantages of the
various syntax decisions:


Cool!

*rummage* *rummage*

Hm. Just as a note, I didn't spot the following (recent?) variant:

class C:
def c(self):
meta:
classmethod
doc('This is a function!')
pass

For example, see the "Decorators proposal" thread.

Thanks for all the hard work.

-- Mark
Jul 18 '05 #2
Mark Bottjer <ma**********@hotmail.com> wrote in message news:<41********@nntp.zianet.com>...
Hm. Just as a note, I didn't spot the following (recent?) variant:

class C:
def c(self):
meta:
classmethod
doc('This is a function!')
pass


I think this would fall under:
Indicator: keyword: 'meta'
Location: post-def
List Notation: One per line
Indentation: Indent decorators only

Right? I added 'meta' to the keyword section.

Steve
Jul 18 '05 #3
Steven Bethard wrote:
Mark Bottjer <ma**********@hotmail.com> wrote in message news:<41********@nntp.zianet.com>...
class C:
def c(self):
meta:
classmethod
doc('This is a function!')
pass

I think this would fall under:
Indicator: keyword: 'meta'
Location: post-def
List Notation: One per line
Indentation: Indent decorators only

Right? I added 'meta' to the keyword section.


I think so, yes. Thanks.

-- Mark
Jul 18 '05 #4

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...
23
by: C. Barnes | last post by:
I vote for def f(): (body of function) This is backwards compatible (Python <= 2.3 raise SyntaxError), and looks much nicer than @. The only problem is that you can't one-line a...
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: Jim Jewett | last post by:
Guido has said that he is open to considering *one* alternative decorator syntax. At the moment, (Phillip Eby's suggestion) J4 <URL: http://www.python.org/moin/PythonDecorators > (section 5.21...
22
by: Ron_Adam | last post by:
Hi, Thanks again for all the helping me understand the details of decorators. I put together a class to create decorators that could make them a lot easier to use. It still has a few glitches...
13
by: Lad | last post by:
I use Python 2.3. I have heard about decorators in Python 2.4. What is the decorator useful for? Thanks for reply L.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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
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,...
0
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...

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.