[Python-Dev] A syntax for function attributes?
Phillip J. Eby
pje@telecommunity.com
Thu, 31 Jul 2003 11:55:21 -0400
At 07:53 AM 7/31/03 -0700, Pat Miller wrote:
>Michael wrote:
>>I don't object to a syntax for function attributes... in fact, I've seen no
>>specific proposal to object to. But I find your point above HIGHLY
>>unconvincing:
>
>I use the classmethod call because its the only (good) way to do
>the task, but I have the same objection. When I write
>
>class Foo:
> def method(self, ...):
> ...
>
> method = classmethod(method)
>
>
>Upon reading, I don't find out the "true meaning" of the method until I
>happen upon the classmethod call.
I agree with the need to put information about a method near the
definition, but I don't think that we need a separate syntax specifically
for function attributes. I think that with PEP 318 or some variant
thereof, it is trivial to create an 'attrs(foo=bar, baz=spam)' function
that can be used as a decorator, eg. in conjunction with classmethod.