On 2013-03-26, Dave Angel <da...@davea.name> wrote: > On 03/26/2013 10:40 AM, Michael Herrmann wrote: >> On Tuesday, March 26, 2013 3:13:30 PM UTC+1, Neil Cerutti wrote: >>> >>> <SNIP> >>> Have you considered adding a keyword argument to each of your >>> global functions, which is normally None, but allows a user to >>> provide a prefered focus window? >>> >>> enter_text("test.txt", focus=save_dialog) >>> >>> press_button(Savebutton, focus=save_dialog) >> >> It's an interesting new idea but I somehow feel it makes the existing >> functions too complicated. Also, having to add it to all existing, and >> future functions sounds a bit too cumbersome to me. >> > > Perhaps Neil didn't make it clear enough. I figure he meant a keyword > argument with an explicit default value of None. (or if you followed my > earlier discussion, default value of focused) > > That way your user can keep using the functions for when there's no > ambiguity, but add a focus= parameter only when needed. > > To go back to my sample wrapper functions, they'd look something like > (untested): > > > def write(*args, focus=focused): > focus.write(*args) > > Of course, the user should only use the wrappers when things > are sure to remain "simple."
Yes, along those lines. Most code would never need to provide the focus= keyword. Only when setting focus in a weird way would it be needed. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list