[Python-Dev] Re: new syntax for wrapping (PEP 318)
Michael Chermside
mcherm at mcherm.com
Fri Feb 27 15:22:53 EST 2004
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
More information about the Python-Dev
mailing list