[Python-Dev] Re: new syntax for wrapping (PEP 318)
Russell E. Owen
rowen at cesmail.net
Thu Feb 26 15:47:32 EST 2004
In article <c1k9fm$hrf$1 at sea.gmane.org>,
Pete Shinners <pete at shinners.org> wrote:
> I'm not too concerned about the syntax. All current proposals weigh about
> equal to me. Although I don't believe "as" makes documentation lookup much
> easier.
>
> I think this feature will be another one of those positive changes that
> effects the entire way python is used. The kind of thing like iterators,
> string methods, etc. I've been playing with the idea for awhile and can
> throw out some extra use cases.
>
> Some of these may even be bad ideas apon further thought, but it's something
> to ponder.
>
>
> def main() [__main__]:
> """specify a function to be run if __name__=='__main__'. this
> would need some other python tricks to actually work."""
>
> def cleanup() [sys.atexit]:
> """ensures this function is called when program quits."""
>...
This looks like too much magic to me -- a recipe for making tricky and
hard-to-read code.
I would rather focus on the heart of PEP 318 and try to make class and
static methods easier to declare, e.g. something like:
def classmethod foo(self, ...):
If one supports arbitrary modifier functions and lists of modifier
functions I think readability is really going to suffer.
I'm usually in favor of generality, but reading the examples above and
others presented in this thread really makes me shudder.
-- Russell
More information about the Python-Dev
mailing list