Alternative decorator syntax - keyword choice
zathras at thwackety.com
Sun Aug 22 17:45:22 CEST 2004
Colin J. Williams wrote:
> Three issues which have not been discussed much are:
> 1. the purpose of the docstring in J2 preceding the funcdef. It it
> to describe the transformers or the function?
I'm not sure I understand this - the implementation as is doesn't make any
changes to the position of the docstring. In some examples I've put:
Largely because some doc generators currently take code like:
And concatenate the "Bla Bla" docs with the "rhubarb" docs. The
location/meaning of the docstring itself is left unchanged.
> 2. the placement of the extra code relative to the funcdef.
> (incidentally, I don't find docstring in the Python grammar)
The docstring isn't handled by the grammar - it's "manually" yanked out the
codeblock during compilation. ie it's based on the semantics of codeblocks
rather than purely the syntax. I suspect that this is the key reason why
putting the extra code inside the function's code block was ruled out.
> 3. whether the PEP 318 processes are to apply to classes as well
> as functions.
The code/grammar tend to suggest not. The implementation I've done for J2 is
really syntactic sugar on top so the semantics aren't changed from 2.4a2.
(The simplest way of testing these things really is to take the easy way
out - download, build and play :)
More information about the Python-list