[Python-Dev] PEP 318 trial balloon (wrappers)

Skip Montanaro skip at pobox.com
Thu Mar 11 16:04:18 EST 2004


    Jim> I am hoping to post a new draft of PEP318 soon.  Unfortunately, the
    Jim> solution that currently looks best to me has not been mentioned
    Jim> before.

    Jim> I wanted to give a heads up, so that people will be able to read
    Jim> the rest of the PEP too.  (And so that I can change it if everyone
    Jim> else hates the new syntax.)

    ...

    Jim> class Foo:
    Jim>     [transform] from:
    Jim>         def bar():
    Jim>             pass

I honestly don't think this is going to fly.  Ignoring the readability
factor (it doesn't read right to me), suppose I have a function foo() which
is 90 lines long and I don't use Emacs, vim or some other editor with a
notion of Python's indentation-based block structure (say, Notepad).  Now I
decide foo() needs to be transform()ed.  It will be tedious and error-prone
to have to reindent the entire function just to wedge in the decorator.  On
the other hand, a decorator syntax which doesn't affect indentation of the
class or function is much easier to apply.

Skip



More information about the Python-Dev mailing list