[Python-3000] Fwd: Conventions for annotation consumers

Ron Adam rrr at ronadam.com
Sun Aug 20 00:27:06 CEST 2006


Paul Prescod wrote:
> On 8/19/06, *Ron Adam* <rrr at ronadam.com <mailto:rrr at ronadam.com>> wrote:
> 
>          @callmeta
>          def foo( a: [ SetDoc("frobination count"), InRange(3,9) ],
>                   b: InSet([4,8,12]) )
>                   -> IsNumber:
>             # code
> 
> 
> What extra information or value does the callmeta decorator provide? For 
> the sake of argument, I'll presume it has some useful function. Even so, 
> it doesn't make sense to explictly attach it to every function.

The callmeta decorator wouldn't provide any extra information itself, 
all it does is decorate(wrap) the functions so that the meta data gets 
called.  It activates the meta data calls.



> Imagine a hundred such functions in a module. Would it be better to do this:
> 
> @callmeta
> def func1(..): ...
> 
> @callmeta
> def func2(..): ...
> 
> @callmeta
> def func3(..): ...
> 
> @callmeta
> def func4(..): ...
> 
> @callmeta
> def func5(..): ...

Isn't this the same?


> Or to do this:
> 
> func1(...):...
> 
> func2(...):...
> 
> func3(...):...
> 
> func4(...):...
> 
> func5(...):...
> 
> callmeta()

So here callmeta() wraps all the functions to activate the meta data? 
That should also work if you want to activate all the functions or a 
large list of functions with meta data.  It could just skip those 
without callable meta data.



>  Paul Prescod





More information about the Python-3000 mailing list