[Python-Dev] Re: Decorators: vertical bar syntax (original) (raw)
Roman Suzi rnd at onego.ru
Sun Aug 8 12:16:28 CEST 2004
- Previous message: [Python-Dev] Re: Decorators: vertical bar syntax
- Next message: [Python-Dev] Re: Decorators: vertical bar syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 7 Aug 2004, Andrew Koenig wrote:
> def foo(): > | classmethod > | accepts(int,int) > | returns(float) >
Thats it! I love it. I like the following variation even better: def foo() | classmethod | accepts(int, int) | returns(float): Alternatively, def foo() | classmethod | accepts(int, int) | returns(float): Yes, I understand that the first of these would require allowing a newline after the | without ending the statement. If it were up to me, I would allow a newline to follow any operator, but if that's too radical, then allowing newlines between the def and the following : would be fine.
I just anted to rewrite those "real-life-looking" examples with my proposed '%' syntax:
def foo() % (classmethod, accepts(int,int), returns(float),):
or formatted:
def foo() % ( classmethod, accepts(int,int), returns(float),):
Or it can be done the this way:
def foo(): ...
foo %= (classmethod, accepts(int,int), returns(float),)
The operation could be called "decorative apply", if the LHS has call attribute. Just a new form of % operation with special syntax for "def" operator.
Sincerely yours, Roman Suzi
rnd at onego.ru == My AI powered by GNU/Linux RedHat 7.3
- Previous message: [Python-Dev] Re: Decorators: vertical bar syntax
- Next message: [Python-Dev] Re: Decorators: vertical bar syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]