Decorator for Enforcing Argument Types

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Thu Dec 21 18:08:08 EST 2006


Chris a écrit :
> I'm not sure if this has been done before,

It has...

> but I couldn't easily find
> any prior work on Google, so here I present a simple decorator for
> documenting and verifying the type of function arguments.
> Feedback/suggestions/criticism is welcome.

<my humble opinion>
Python is dynamic, and fighting against the language is IMHO a really 
bad idea. The only places where theres a real need for this kind of 
stuff are when dealing with the "outside world" (IOW : inputs and 
outputs). And then packages like formencode can do much more than mere 
type-checking
</my humble opinion>




More information about the Python-list mailing list