Help me pick an API design (OO vs functional)

Mitya Sirenef msirenef at lightbird.net
Wed Mar 27 09:56:55 EDT 2013


On 03/27/2013 05:10 AM, Michael Herrmann wrote:
>> At the very least, for  small dialogs it's sipmpler to do:
 >> >
 >> > with press(CTRL + 's'):
 >> >      write("test.txt", into="File name")
 >> >      click("Save")
 > I think what the context manager approach really has going for itself
 > is the syntactic structure it gives to scripts, that makes it easy to
 > see what is going on in which window. Semantically, however, I think
 > the fit of this approach has some rough edges: The fact that there
 > needs to be some special treatment for ALT + TAB, that actions such as
 > `press` "sometimes" return values that are needed to continue the
 > script and so on. It really has its appeal, but I think it's a bit too
 > special and intricate to be used by a broad audience.
 >


I think alt-tab has to be special in any case. Regular alt-tab would act
like the GOTO statement. As a programmer looking at a script you have no
idea where you just alt-tabbed to without possibly looking through
dozens of lines of previous code.

Keypresses that start a new window also seem pretty special to me.
They're inherently special. After all, the essential function of a
windowing system is when a new window is created, which means subsequent
operations have an entirely different meaning, in a text editor <del>
key will delete a character, in a file manager <del> key will delete a
file!

But, as I mentioned, if you can get away with treating simple dialogs
implicitly (and I don't see why you can't, at this point), that'd be the
preferred way for me.

  -m


-- 
Lark's Tongue Guide to Python: http://lightbird.net/larks/

"The condition of man is already close to satiety and arrogance, and
there is danger of destruction of everything in existence."
- a Brahmin to Onesicritus, 327 BC, reported in Strabo's Geography




More information about the Python-list mailing list