On 5/19/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > So the real question is how best to write "A callable with this > signature". I do not think the right answer is an inline recreation. > Compare to > > from inspect import signature as sig > > def button_pushed(button, > pressure=1, > alarm=False, > repeated=False, ... > > # Give the signature a name, with ButtonFunc=sig(button_pushed) ? nah... > > def foo(self, action:sig(button_pushed)): ...
I like this idea. Maybe it could be called like() or Like(). (And it still lets you inline if you really want: just put a lambda in there. :-) Having this for the complex cases would make it possible to simplify Function() to the bare minimum: fixed positional args and returns=xyzzy. > > Think about it: when's the last time you had a callback parameter that > > was called with keyword arguments? > > It may be reasonable to require that the callback accept a keyword > such as 'color', rather than requiring it to take all possible GUI > parameters in a specific order. May be. But somehow I don't see a big use case for a callback being called with all possible keyword arguments. It's more likely that you'd pass a single object containing all the UI parameterizations. As I urged Collin before, can someone please come up with a realistic motivating example? If there aren't any I will put my foot down and call YAGNI on any mechanism to specify signatures with keyword arguments, *args, or **kwds. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
