[Python-Dev] Re: PEP 318: Decorators last before colon (original) (raw)
Simon Percivall s.percivall at chello.se
Wed Mar 31 11:10:23 EST 2004
- Previous message: [Python-Dev] Re: PEP 318: Decorators last before colon
- Next message: [Python-Dev] Re: PEP 318: Decorators last before colon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2004-03-31, at 17.42, Guido van Rossum wrote:
Taking the prefix position as given for the moment, why overload list literal syntax versus something currently illegal and meaningless? Such as
# almost as easy, or Yes. This looks better and will make it more clear that it's a special case. Otherwise the decorators will look too decoupled from the function. Why does <...> look better than [...]? To me, <...> just reminds me of XML, which is totally the wrong association. There are several parsing problems with <...>: the lexer doesn't see <_ _and > as matched brackets, so you won't be able to break lines without using a backslash, and the closing > is ambiguous -- it might be a comparison operator.
I'm not sure is the best solution but it sure is better than [decorator]. Someone learning Python will probably be profoundly confused when seeing that special case. It also really feels like the decorators are decoupled from the function. The coupling between the decorators and the function would perhaps not appear to be greater with another syntax; but it would stand out.
Unlike docstrings which are used a lot and which documentation and books explain early on, decorators won't be used that much. It would only make it harder to learn Python if someone looks through code and sees a decorator. Also: When explaining lists in a book you'd have to mention that "there are special cases which we will discuss in an addendum to chapter 27".
Also, it'll make it so much harder to search for decorators if they are lists instead of a special syntax.
- Previous message: [Python-Dev] Re: PEP 318: Decorators last before colon
- Next message: [Python-Dev] Re: PEP 318: Decorators last before colon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]