[Python-Dev] Re: PEP 318: Decorators last before colon (original) (raw)

David Eppstein eppstein at ics.uci.edu
Mon Apr 5 22:06:58 EDT 2004


In article <3AA96ED4-876E-11D8-A42F-0003934AD54A at chello.se>, Simon Percivall <s.percivall at chello.se> wrote:

On 2004-04-06, at 01.24, David Eppstein wrote: > > Ok, then how about > > def ... > ? > > '<' can't start an expression or statement currently, can it?

Yeah. I think that would look better. On the other hand ... On 2004-03-31, at 17.42, Guido van Rossum wrote: > 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.

Well, Mike Pall's long message "The Need for a Declarative Syntax" convinced me that some kind of bracketed prefix is the best location for these things, but I still don't like [...] because it already has a (useless) meaning, so declarators would pass silently in old Pythons. And the same objection applies to all other existing brackets. So, angle brackets seem like the cleanest remaining choice.

Re the lexer, I don't see this as a big problem as long as multiple declarators can be handled by multiple <...> pairs. Re the ambiguity, I think comparisons shouldn't normally appear in declarators, so it's ok if they have to be parenthesized.

-- David Eppstein http://www.ics.uci.edu/~eppstein/ Univ. of California, Irvine, School of Information & Computer Science



More information about the Python-Dev mailing list