[Python-Dev] method decorators (PEP 318)

Greg Ewing greg at cosc.canterbury.ac.nz
Sun Mar 28 20:34:29 EST 2004


Skip Montanaro <skip at pobox.com>:

> 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.

Maybe we could do with some more special cases concerning
literals of other kinds?

  def foo():
    {'author': "Guido", 'deprecated': 1}
    ...

or

  def foo():
    class __attributes__:
      author = "Guido"
      deprecated = 1
    ...

Everything inside these would have to be constant (if you
want them computed at run time, you have to use the old
fashioned method).

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list