473,405 Members | 2,294 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,405 software developers and data experts.

Another worthless decorator syntax suggestion

I didn't see this form of decorator syntax listed on the Python
Decorator Wiki, but that page is now frozen so I'm posting it here. I
realize the futility (and ignominy!) of posting such a thing,
especially at such a late date, so I'm happy to say I have absolutely
no ego invested in it ;)

Behold:

def foo(a, b),
classmethod,
synchronized,
martinized:
pass

Since these are operations on "foo", it doesn't make sense that they
be nested deeper than "foo", nor that they come before "foo"; those
are the two reasons I'm not a big booster of J2 (or of the
pie-syntax). Personally I think it's natural that they be indented at
the same level as the "def" but below it; the "def" and function name
are more important, so they should go first, but these are siblings of
the "def" and therefore should not be indented. After all, aren't the
name and arguments of a function just more attributes of the function?
And when you decorate a function in Python 2.3, the decoration code is
at the same level as the "def", so I assert that this *is*
semantically sensible, if syntactically unique. Furthermore, *not*
indenting the decorators helps visually set them apart from the
function body.

I could go on, but either I have your interest at this point or I
don't... elaborating won't help. I look forward to seeing the final
decision of our BDFL on this subject, as I suspect I will agree with
it.

Cheers,
/larry/
Jul 18 '05 #1
2 1350
On Tue, 14 Sep 2004 11:36:05 +0100 (BST), Michael Sparks
<za*****@thwackety.com> wrote:

I look forward to seeing the final decision of our BDFL on this subject,
as I suspect I will agree with it.


He gave it - the pies win. Guido gave a very good/nice summary of why as


Yuck... A very bad decision, IMHO. One that takes Python's syntax closer to
Perl's mess.
Jul 18 '05 #2
Fernando Rodríguez wrote:
Yuck... A very bad decision, IMHO. One that takes Python's syntax closer to
Perl's mess.


Probably not. Perl aims to be a flexible language that tries to mimic
real languages in that even simple statements can be formulated
in many ways. The hope is that this will allow people to better express
the purpose of the code. Whether or not this is a realistic goal
is debatable (with all signs pointing to no ;-) ).

Istvan.
Jul 18 '05 #3

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...
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):
30
by: ajsiegel | last post by:
Arthur wrote: >> And either intuitively, or consciously, he is doing something that >> offsets it from something truly intergrated into the core of the >> language. By breakling all of his own...
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/. ...
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...
188
by: christopher diggins | last post by:
I have posted a C# critique at http://www.heron-language.com/c-sharp-critique.html. To summarize I bring up the following issues : - unsafe code - attributes - garbage collection -...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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.