Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41828

Re: Help me pick an API design (OO vs functional)

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <kwpolska@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'explicit': 0.07; 'subject:design': 0.09; 'wrong,': 0.09; 'api': 0.11; 'cc:addr :python-list': 0.11; 'subject:Help': 0.11; 'windows': 0.15; "'a',": 0.16; 'gpg': 0.16; 'imo.': 0.16; 'prefer.': 0.16; 'pythonistas': 0.16; 'sense,': 0.16; 'subject:API': 0.16; 'world!")': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'helpful': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'michael': 0.29; 'respective': 0.29; 'message- id:@mail.gmail.com': 0.30; '25,': 0.31; 'could': 0.34; 'subject: (': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'library.': 0.36; 'url:org': 0.36; 'should': 0.36; 'changing': 0.37; 'too': 0.37; 'version,': 0.38; 'pm,': 0.38; 'extremely': 0.39; 'users': 0.40; 'how': 0.40; 'most': 0.60; 'mar': 0.68; 'ps.': 0.84; 'ugly,': 0.84; 'don\xe2\x80\x99t': 0.91; 'url:tk': 0.95; 'opt': 0.97; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=dpGW4B11AcMiUdZIKoj9bdQEksUO4s/eRu6Xqxyi+V0=; b=Eyz+xaP2K+OXwoJ3if2XgVwej/ZcwU8Fs3oawC3+XufTg2W3UeFH8wx/PCymJt+ASI LIwxCWCHa955WkgEanksdlGk0dgYaW4EdnXyfEzakPmAG+ISHqVuyrxj8tM9NhS1YSM6 tTvy+4RNGn8UllBLIyfm0ahloCqsJXMcS/Fvw9vbDnw+sZ1beeicdVrgQog4nCtm0vge dNt6l1gDfmyMzm7dpMd+v2tvzafGv1xuQOG+NB6HbRiGYQ2/Tdpixu+siWKtU541x6YS 5Fi/xiiNP71NtS6tMXdgp8sE16xBDW6KBzaqTo6hKWDTCu8YDZb6lzQzG7OGaATCEa0L y4pQ==
X-Received by 10.50.17.71 with SMTP id m7mr8844234igd.14.1364240566211; Mon, 25 Mar 2013 12:42:46 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <68da956e-ebe0-4f58-92cd-f7ffff0075b4@googlegroups.com>
References <68da956e-ebe0-4f58-92cd-f7ffff0075b4@googlegroups.com>
From Kwpolska <kwpolska@gmail.com>
Date Mon, 25 Mar 2013 20:42:25 +0100
Subject Re: Help me pick an API design (OO vs functional)
To Michael Herrmann <michael.herrmann@getautoma.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3699.1364240574.2939.python-list@python.org> (permalink)
Lines 58
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1364240574 news.xs4all.nl 6929 [2001:888:2000:d::a6]:52742
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41828

Show key headers only | View raw


On Mon, Mar 25, 2013 at 8:29 PM, Michael Herrmann
<michael.herrmann@getautoma.com> wrote:
>         notepad_1 = start("Notepad")
>         notepad_2 = start("Notepad")
>         notepad_1.write("Hello World!")
>         notepad_1.press(CTRL + 'a', CTRL + 'c')
>         notepad_2.press(CTRL + 'v')

Explicit is better than implicit.  Changing windows should be explicit
and not implified by your library.

>         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')

Much better.

>         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.

>         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')

That is nice and makes sense, because a global function feels wrong,
at least for me.

> It would be extremely helpful for us if you could let me know which way of using the API you would prefer. If you opt for an explicit version, how would you call the respective method? "activate" / "switch_to" / "focus" or something else?

Window().focus() is the best IMO.

PS. do you plan a version for non-Windows OSes?  Also, €99 is too expensive.

-- 
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail                | always bottom-post
http://asciiribbon.org        | http://caliburn.nl/topposting.html

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-25 12:29 -0700
  Re: Help me pick an API design (OO vs functional) Kwpolska <kwpolska@gmail.com> - 2013-03-25 20:42 +0100
    Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-25 13:48 -0700
      Re: Help me pick an API design (OO vs functional) Chris Angelico <rosuav@gmail.com> - 2013-03-26 08:08 +1100
        Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 01:53 -0700
          Re: Help me pick an API design (OO vs functional) Chris Angelico <rosuav@gmail.com> - 2013-03-26 22:38 +1100
            Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 05:13 -0700
            Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 05:13 -0700
    Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-25 13:48 -0700
  Re: Help me pick an API design (OO vs functional) Ethan Furman <ethan@stoneleaf.us> - 2013-03-25 16:11 -0700
    Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 02:06 -0700
      Re: Help me pick an API design (OO vs functional) Dave Angel <davea@davea.name> - 2013-03-26 06:26 -0400
        Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 05:04 -0700
          Re: Help me pick an API design (OO vs functional) Dave Angel <davea@davea.name> - 2013-03-26 08:42 -0400
            Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 07:33 -0700
              Re: Help me pick an API design (OO vs functional) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-26 22:37 +0000
                Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-27 02:34 -0700
                Re: Help me pick an API design (OO vs functional) Ethan Furman <ethan@stoneleaf.us> - 2013-03-27 09:45 -0700
                Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-28 03:54 -0700
                Re: Help me pick an API design (OO vs functional) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-28 00:42 +0000
                Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-28 04:41 -0700
          Re: Help me pick an API design (OO vs functional) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-26 12:59 +0000
            Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 07:26 -0700
  Re: Help me pick an API design (OO vs functional) Mitya Sirenef <msirenef@lightbird.net> - 2013-03-25 19:40 -0400
    Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 02:38 -0700
      Re: Help me pick an API design (OO vs functional) Chris Angelico <rosuav@gmail.com> - 2013-03-26 22:43 +1100
        Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 05:18 -0700
      Re: Help me pick an API design (OO vs functional) Mitya Sirenef <msirenef@lightbird.net> - 2013-03-26 09:41 -0400
        Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 07:59 -0700
          Re: Help me pick an API design (OO vs functional) Chris Angelico <rosuav@gmail.com> - 2013-03-27 02:16 +1100
            Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-27 01:45 -0700
          Re: Help me pick an API design (OO vs functional) Mitya Sirenef <msirenef@lightbird.net> - 2013-03-26 18:01 -0400
            Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-27 02:10 -0700
              Re: Help me pick an API design (OO vs functional) Mitya Sirenef <msirenef@lightbird.net> - 2013-03-27 09:56 -0400
                Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-28 03:52 -0700
    Re: Help me pick an API design (OO vs functional) Neil Cerutti <neilc@norwich.edu> - 2013-03-26 14:13 +0000
      Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 07:40 -0700
        Re: Help me pick an API design (OO vs functional) Dave Angel <davea@davea.name> - 2013-03-26 12:41 -0400
          Re: Help me pick an API design (OO vs functional) Neil Cerutti <neilc@norwich.edu> - 2013-03-26 17:25 +0000
          Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-27 01:55 -0700
            Re: Help me pick an API design (OO vs functional) Chris Angelico <rosuav@gmail.com> - 2013-03-27 22:44 +1100
              Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-27 05:23 -0700
              Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-27 05:23 -0700
  Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-04-04 00:05 -0700

csiph-web