[Python-3000] PEP Draft: Class Decorators

Collin Winter collinw at gmail.com
Wed Feb 28 23:15:30 CET 2007


On 2/28/07, Jack Diederich <jackdied at jackdied.com> wrote:
[snip]
> History and Implementation
> ==========================
>
> Class decorators were originally proposed in PEP318 [1]_ and were rejected
> by Guido [2]_ for lack of use cases.  Two years later he saw a use case
> he liked and gave the go-ahead for a PEP and patch [3]_.

While I can look up the use-case that prompted Guido to change his
mind via the footnote, I'd appreciate having a sampling of use-cases
listed in the PEP itself.

[snip]
> Grammar/Grammar is changed from
>
>    funcdef: [decorators] 'def' NAME parameters ['->' test] ':' suite
>
> to
>
>     decorated_thing: decorators (classdef | funcdef)
>     funcdef: 'def' NAME parameters ['->' test] ':' suite

The PEP should show how 'decorated_thing' fits into the existing grammar.

Thanks,
Collin Winter


More information about the Python-3000 mailing list