[Python-Dev] method decorators (PEP 318) (original) (raw)

Robert Brewer fumanchu at amor.org
Fri Mar 26 15:51:41 EST 2004


Skip Montanaro wrote:

Guido> (For those worried that the function attribute sets appear to Guido> belong to the body, I point to the precedent of the docstring. Guido> IMO the start of the function body is a perfectly fine place for Guido> metadata about a function.)

The docstring is a bit of a different beast. They were added before general function attributes, right? As such, they are a partial solution to a more general problem. Had function attributes been available at that time the special nature of "if the first object in the module/function/class is a string literal, make it the docstring" wouldn't have been (as) necessary.

I can just picture the article:

"Unifying functions and classes in Python 2.5"

Introduction

"Python 2.5 introduces the first phase of "function/class unification". This is a series of changes to Python intended to remove most of the differences between functions and classes. Perhaps the most obvious one is the restriction against declaring attributes of functions (such as docstrings and other metadata) in a 'def' statement..."

:D

Robert Brewer MIS Amor Ministries fumanchu at amor.org



More information about the Python-Dev mailing list