[Python-Dev] method decorators (PEP 318)
walter at livinglogic.de
Fri Mar 26 17:28:49 EST 2004
Guido van Rossum sagte:
> [Walter Doerwald]
>> For me '@' looks like something that the compiler shouldn't see.
> I don't understand. Why? Is that what @ means in other languages? Not
> in JDK 1.5 -- the compiler definitely sees it.
@ has no meaning in current Python and is seldom used in normal text, so
it seems to be perfect for an escape character that is used by a
documentation extractor or preprocessor, i.e. for markup that is somehow
"orthogonal" to the program source. But as part of a normal Python source
it feels like a wart.
>> How about:
>> def foobar(self, arg):
>> .author = AuthorInfo(author="GvR", version="1.0",
> copyright="GPL", ...)
>> .deprecated = True
> No, I want to reserve the leading dot for attribute assignment to a
> special object specified by a 'with' statement, e.g.
> with self:
> .foo = [1, 2, 3]
> .bar(4, .foo)
I know, but inside a function the leading dot could default to function
attribute assigment in the absence of a with statement.
That makes me wonder, what a leading dot should mean at class or module
More information about the Python-Dev