Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Limits the returnvalue to the given minimum and maxmimum values.
- """
- def limit(min,max):
- def wrapper(f):
- def nf(*args,**kwargs):
- r = f(*args,**kwargs)
- if r < min: return min
- if r > max: return max
- return r
- nf.__name__ = f.__name__
- return nf
- return wrapper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement