On Mon, 2006-02-13 at 14:13, Avi Kak wrote: > Hello: > > Suppose I write a function that I want to be called > with ONLY keyword argumnts, how do I raise an > exception should the function get called with > what look like position-specfic arguments? > > Any help would be appreciated.
Something like this should do the trick: def f(*args, **kwargs): if args: raise TypeError, "Please use keyword arguments." ... -Carsten -- http://mail.python.org/mailman/listinfo/python-list