[Python-Dev] PEP 318 bake-off?
Guido van Rossum
guido at python.org
Thu Apr 1 14:08:26 EST 2004
> >What I'm asking (especially of Phillip) is to collect a set of
> >realistic method declarations using decorators; we can then
> >collectively format these using any of the possible syntaxes, and see
> >how they look.
> I'd be happy to scrounge up some samples from existing code using
> 'property' and 'classmethod' as well as some of PEAK's decorators, and I
> definitely think that Jack Diedrich and Bob Ippolito's samples should be
> included as well.
> Important question, though: do we include code bodies, or just use 'pass'
> for the bodies? If we include the body, how much of the body? Should we
> include entire classes, especially if the class itself needs a decorator,
> and multiple methods have decorators?
Why not provide the bodies, for added realism?
(I still think class decorators are a separate case, and much weaker
-- you can do this by having a single 'decoratable' metaclass and
setting __decorators__ = [...] in the class body.)
> Next, does anybody have any actual use cases for attribute decoration
> today? We're probably not going to get a lot of that from current code
> samples. I can make up some examples that throw in every possible option
> that PEAK provides in order to get some "lots of decoration" samples, but
> they wouldn't be "real" uses in that case. But I guess that maybe Bob's
> examples might be wordy enough.
I think that SPARK syntax and everything else that people have
traditionally added to docstring markup that isn't strictly speaking
documentation (even some extreme cases of doctest usage) ought to be
considered as candidates for attribute-ification.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev