[Python-Dev] syntax for funcion attributes

Mark Nottingham mnot@mnot.net
Fri, 28 Feb 2003 10:58:11 -0800


Hello,

I'm not a python-dev regular, so sorry if this is a FAQ. What's the status
of defining a syntax for function attributes (PEP 232)? I'm using __doc__
to carry metadata about methods right now, but would very much like to use
function attributes. However, without a specialized syntax, I'm stuck
doing things like

VeryLongMethodName.MetadataName = "foo"

which is fine if it's a one-off, but I'd like others to use the code, and
this isn't exactly a friendly mechanism. The proposals in the PEP would be
fine; I was thinking something like

def foo(a):
    """this is the docstring"""
    .this_is_a_function_attribute = 1

but that's just off the top of my head.

I'm happy to do some work writing a PEP if there's some consensus about
what syntax would be preferable.

Cheers,

--
Mark Nottingham