2 ms·
one workaround is to make your decorators require keyword arguments (which often makes good sense from a documentation POV). you can then add a first keyword a
by andrewcooke 15y ago
one workaround is to make your decorators require keyword arguments (which often makes good sense from a documentation POV). you can then add a first keyword argument as gatekeeper, with default value None, and check whether it has been defined. if so, the decorator was used incorrectly.
you can see what i mean here - http://code.google.com/p/lepl/source/browse/src/lepl/matchers/support.py#599 http://code.google.com/p/lepl/source/browse/src/lepl/matcher...
this doesn't fix the problem completely, of course, but it does mean that a user that types @foo instead of @foo() gets a helpful warning explaining exactly what they have done wrong.