[Python-Dev] Re: A syntax for function attributes?
Thu, 31 Jul 2003 14:55:51 -0700
On Thursday, July 31, 2003, at 05:06 AM, Michael Chermside wrote:
> I don't object to a syntax for function attributes... in fact, I've
> seen no
> specific proposal to object to.
See PEP 232 , which lists several.
> Only once we see how very useful this really is should we consider
> introducing special syntax for it, because the less special syntax
> that Python has, the better it is (if we keep functionality constant).
I find function attributes very useful as a way of associating metadata
with functions and methods; this style of coding is gaining a lot of
traction elsewhere (e.g., JSRs 175  and 181  in the Java world).
I'll be happy to explain my use case if that would help.
> syntax... like PEP 310 where we prevent the race condition. And the
> third exception is cases where the proponants claim that the syntax
> change itself is what makes the difference -- for instance those
> who point to ruby's blocks as very useful while Python's lambda's
> have just a little bit too much typing. (Not that I agree, necessarily,
> but they're entitled to make their point.)
I think that's the boat we're in now; the overhead of writing precludes
most people from using function attributes for metadata, because it
places too much of a readability as well as type-ability barrier in the
way; using __doc__ is the path of least resistance, until there is a
heres_my_function_name.my_attribute = "Foo"
Without a special syntax, I think we'll see more and more abuses of
"""my_attribute = "Foo" """