Brett Cannon wrote: > The second question is whether it is worth providing a function that > will either figure out if a tuple and dict representing arguments > would work in calling the function. Some have even suggested a > function that returns the actual bindings if the call were to occur. > Personally I don't see a huge use for either, but even less for the > latter version. If people have a legit use case for either please > speak up, otherwise I am tempted to keep the object simple.
One use case that comes to mind is a type-checking decorator (or precondition-checking decorator, etc): @precondition(lambda x,y: x>y) @precondition(lambda y,z: y>z) def foo(x, y, z): ... where precondition is something like: def precondition(test): def add_precondition(func): def f(*args, **kwargs): bindings = func.__signature__.bindings(args, kwargs) if not test(**bindings): raise ValueError, 'Precontition not met' func(*args, **kwargs) return f return add_precondition -Edward _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com