Help me pick an API design (OO vs functional)

Chris Angelico rosuav at gmail.com
Tue Mar 26 07:43:18 EDT 2013


On Tue, Mar 26, 2013 at 8:38 PM, Michael Herrmann
<michael.herrmann at getautoma.com> wrote:
> What do you think of designs #3 and #4?
>
>         notepad_1 = start("Notepad")
>         notepad_2 = start("Notepad")
>         switch_to(notepad_1)
>         write("Hello World!")
>         press(CTRL + 'a', CTRL + 'c')
>         switch_to(notepad_2)
>         press(CTRL + 'v')
>
>         notepad_1 = start("Notepad")
>         notepad_2 = start("Notepad")
>         notepad_1.activate()
>         write("Hello World!")
>         press(CTRL + 'a', CTRL + 'c')
>         notepad_2.activate()
>         press(CTRL + 'v')

Ehh, I referred to these as options 2 and 4. Got lost in the indexing
somewhere. These are the same two I meant, though - these are the
options I think are the most plausible.

(Hindsight being 20/20, it'd have been awesome if the original
snippets had had identifiers next to them. Oh well, no matter.)

ChrisA



More information about the Python-list mailing list