Argument Decorators Enhancement?

bayerj bayerj at in.tum.de
Tue May 16 12:42:07 CEST 2006


Hi,

-1 because I find it extremly hard to read and not necessary in that
scale.

Actually, there are a lot of recipes in the Cookbook [1] on how to use
decorators for type-checking. On example is:

@require(int, int)
def add(x,y): return x + y

Which I find much more readable, easier to implement and even backwards
compatible:

def add(x,y): return x + y
add = require(int, int)(add)

g2g,
Justin

[1] http://aspn.activestate.com/ASPN/Cookbook/Python/




More information about the Python-list mailing list