Help me pick an API design (OO vs functional)
rosuav at gmail.com
Mon Mar 25 22:08:53 CET 2013
On Tue, Mar 26, 2013 at 7:48 AM, Michael Herrmann
<michael.herrmann at getautoma.com> wrote:
> On Monday, March 25, 2013 8:42:25 PM UTC+1, Kwpolska wrote:
>> > notepad_1 = start("Notepad")
>> > notepad_2 = start("Notepad")
>> > with notepad_1:
>> > write("Hello World!")
>> > press(CTRL + 'a', CTRL + 'c')
>> > with notepad_2:
>> > press(CTRL + 'v')
>> That’s ugly, and don’t forget that your users aren’t Pythonistas most
>> of the time.
> I kind of like the context manager solution because the indentation makes it very obvious what happens in which window. You are right about our target group though. Also, the "with" is not as explicit as it probably should be.
What happens at the __exit__ of the context manager? What happens if
context managers are nested? I'd be inclined to the simpler option of
an explicit switch (since focus doesn't really "stack" and it'd feel
weird for focus to *sometimes* switch away when you're done working
with one window), though the context manager syntax does have its
>> PS. do you plan a version for non-Windows OSes? Also, €99 is too expensive.
> We'd of course love to support other platforms but don't currently have the resources to do this. We actually just wrote a blog entry about this and some related questions: http://www.getautoma.com/blog/automa-faq If we have something wrong, do let us know in the comments over there!
Make the API clean enough and someone else might well write a Linux
equivalent. Then it'll be as simple as a try/import/except/import at
the top and multiple platforms will work.
> P.S.: First-time bottom-posting!
Congrats! Feels good, doesn't it :)
More information about the Python-list