Decorator for Enforcing Argument Types

Fredrik Lundh fredrik at pythonware.com
Fri Dec 22 13:14:16 EST 2006


Peter Wang wrote:

> I understand that we're all adults, but it's still nice to have the
> computer tell us when we're being childish. :)

like this?

def accepts(*types):
     raise RuntimeError("don't be childish!")

def returns(rtype):
     raise RuntimeError("don't be childish!")

</F>




More information about the Python-list mailing list