RE: [Python-Dev] Re: new syntax for wrapping (PEP 318)

I've been reading the hailstorm of comments on PEP 318. Yipes... did I help start that off? Lots of good ideas (and some others too) have been raised. I thought I would just weigh in with what I have learned so far. (1) Starting with Pete Shiner's creative list and butressed by subsequent suggestions, I am more convinced than ever that function decorators are actually VERY USEFUL. I'm now strongly +1 on PEP 318 with SOME syntax. (2) I originally objected to "def foo (bar,baz) [qux, quux]:" on the grounds that it relied too heavily on punctuation and using a keyword ("def foo (bar,baz) as qux, quux") would be better. I think that most of my objections have been addressed: * I said "but what would newbies look up", but then Paul Moore pointed out "Who, as a new user, saw 'import something as another' and looked up 'as' rather than 'import'?". He's right. * I said "def marmalade(self) [classmethod]:" versus "def marmalade(self): [classmethod]" is confusing, but then I think that two objections still stand: * "def foo (bar,baz) [qux, quux]:" is certainly not "executable pseudocode". * This is yet another meaning for "[]" in Python, it is certainly not indexing, and it differs subtly from list literals an list comprehensions. I suppose this objection could be mitigated by declaring that any expression evaluating to an iterable could be used (and sane people would use a list literal). However, there are objections to all other syntaxes that have been proposed, and I'm beginning to think that "def foo (bar,baz) [qux, quux]:" may be the best of the bunch despite these shortcomings. -- Michael Chermside

Michael Chermside <mcherm@mcherm.com> writes:
I think that two objections still stand:
* "def foo (bar,baz) [qux, quux]:" is certainly not "executable pseudocode".
This has been mentioned a couple of times. I'm not sure I see the issue, though. With concrete examples, it *does* read like executable pseudocode to me: def factory(cls, arg1, arg2) [classmethod]: ... reads to me as "define a factory function, with arguments cls, arg1, arg2 - it's a class method". def tidy_up() [onexit]: reads as "define the tidy_up function which is called on exit from the program". Getting the decorator names right is the key thing, I think. Paul. -- This signature intentionally left blank
participants (2)
-
Michael Chermside
-
Paul Moore