[Python-Dev] A syntax for function attributes?

Barry Warsaw barry@python.org
30 Jul 2003 12:05:00 -0400


On Wed, 2003-07-30 at 11:38, Mark Nottingham wrote:
> PEP 232 lists syntactic support for function attributions to be a 
> possible future direction. I would very much like to use function 
> attributes for associating metadata with functions and methods, but the 
> lack of such syntactic support precludes their use, so I end up 
> (ab)using __doc__.
> 
> Has there been much further consideration of this issue? I'm not too 
> particular about the chosen syntax, I just need something that doesn't 
> require qualification with the function name (which tends to reduce 
> readability/typeability, in some cases drastically so).
> 
> I'm happy to write a PEP if that will help, but wanted to get a sense 
> of what people's thinking was.

Function attributes of course already exist.  They seem like they'd be
really cool to use <wink>.

But I agree.  I think we did well not introducing new syntax for Python
2.3 so we owe it to ourselves to break that bad habit. :)  

I'd also like to see syntactic support for method annotations, hooking
into descriptors.  I've been using a lot of properties in some recent
code and while they are very very cool (and IMO improve Python in some
important ways), they are still too tedious to use.  I think the method
annotation idea would be an elegant addition.

-Barry