Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'explicitly': 0.05; 'interpreter': 0.05; 'correct.': 0.07; 'imply': 0.09; 'subject:design': 0.09; 'to:addr:comp.lang.python': 0.09; 'window.': 0.09; 'api': 0.11; 'cc:addr:python-list': 0.11; 'subject:Help': 0.11; 'wrote': 0.14; 'windows': 0.15; '"hello': 0.16; 'api,': 0.16; 'command,': 0.16; 'executed.': 0.16; 'internally': 0.16; 'lying,': 0.16; 'opens,': 0.16; 'subject:API': 0.16; 'exception': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'otherwise,': 0.22; 'previously': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'options': 0.25; 'script': 0.25; 'performing': 0.26; 'switch': 0.26; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'michael': 0.29; 'chris': 0.29; "doesn't": 0.30; "i'm": 0.30; '(which': 0.31; 'keys': 0.31; 'post.': 0.31; 'allows': 0.31; 'there.': 0.32; 'text': 0.33; 'open': 0.33; 'running': 0.33; 'actual': 0.34; 'moment': 0.34; "i'd": 0.34; 'could': 0.34; 'subject: (': 0.35; 'common': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'activate': 0.36; 'in.': 0.36; 'sequence': 0.36; 'next': 0.36; 'method': 0.36; 'possible': 0.36; 'should': 0.36; 'so,': 0.37; 'two': 0.37; 'being': 0.38; 'actions': 0.38; 'window': 0.38; 'previous': 0.38; 'that,': 0.38; 'system.': 0.39; 'either': 0.39; 'skip:u 10': 0.60; 'commands': 0.60; 'identify': 0.61; 'march': 0.61; 'back': 0.62; 'such': 0.63; 'happen': 0.63; 'effectively': 0.66; 'reply': 0.66; 'side': 0.67; 'between': 0.67; '26,': 0.68; 'brain': 0.68; 'risk': 0.72; '(yet)': 0.84; 'fourth': 0.84; 'tie': 0.84; 'absolutely': 0.87; '2013': 0.98 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:path:newsgroups:date:in-reply-to:complaints-to :injection-info:nntp-posting-host:references:user-agent :x-google-web-client:x-google-ip:mime-version:message-id:subject :from:to:cc:content-type:content-transfer-encoding :x-gm-message-state; bh=X08ygj3TScD3fkWCC2/KMUgUC7KFIfqKfRWgCAxae9Y=; b=Yg2KTv1FFbYYZvRIqkQa4ZB115sHde1u81LE4Z22TYLt3QmZNVzNJdJpPYBVi6VL9a WKsUZKyG4K0tRrUfewFCLAa1c9so9G9YivkEhxhy2UzBj/zI7tQxdoHc+7lnOXq+dXhl UBN6JwwxsWX+QgL5DSdDFf4rtQeM/D012Iz2IXDVt5Kvm2WTLI3ZTJh7BYaYI/71VV3M FxKC1FpnqLQFWcQeZ4mt1aFZ/QyBEcYZwuGroS+CAghNSkV7EJGi7cXQbq5prpcMrMxT qopTbrpm1GBK2E4M+oEqbtYC24rKoikonUwL5u6aGGKbPL2OFjT4ZgBRfZl6mgsdT1TC 9pcg== X-Received: by 10.49.85.35 with SMTP id e3mr933065qez.7.1364299994804; Tue, 26 Mar 2013 05:13:14 -0700 (PDT) Newsgroups: comp.lang.python Date: Tue, 26 Mar 2013 05:13:14 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=89.68.221.197; posting-account=oknH1QoAAABqzbD_5ziFTvLQsqNk2LbU References: <68da956e-ebe0-4f58-92cd-f7ffff0075b4@googlegroups.com> <4b2d2295-cffd-4965-8d75-ebd4f0b9da32@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 89.68.221.197 MIME-Version: 1.0 Subject: Re: Help me pick an API design (OO vs functional) From: Michael Herrmann To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQkoONLP8xF4kz6o8fGSiRBIT8vfub3iQpOW1xqHdqlCTOkkVYtcyjmdwg1XDCAKjkgTHmGQ 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364300577 news.xs4all.nl 6843 [2001:888:2000:d::a6]:58162 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41891 On Tuesday, March 26, 2013 12:38:35 PM UTC+1, Chris Angelico wrote: > ... > Fundamental point: As I understand the API, it doesn't *actually* tie > to a window. You don't locate the Notepad window and send it keys - > you switch focus to Notepad and then send keys to the whole system. Is > this correct? I'm basing my understanding on this paragraph from your > original post: >=20 > > We do not (yet) have a functionality that allows you to explicitly swit= ch to a > > specific window. Such a functionality would for instance make it possib= le to > > open two Notepad windows using the start(...) command, and copy text > > between them. >=20 > If so, then all of the method-based options are effectively lying, > because they imply a binding that's not there. The actual sequence of > actions includes imperatives of "switch to some other window", so I > think that's what the API should reflect. Otherwise, there's risk that > something will get horribly horribly confused between the programmer's > brain and the end result (which could happen on either side of your > code). As I just wrote in my reply to Dave, internally we know very well which win= dow an action is to be performed in. This window is the window that'd be in= the foreground after the previous action, if nothing interferes with the s= ystem while the script is being executed. A common exception is when you en= ter commands in the interactive interpreter: say you write >>> start("Notepad") The Notepad window opens, but for you to enter the next command, you have t= o switch back to the interpreter window. If you do that, and enter >>> write("Hello World") then we remember that you were previously working with the Notepad window a= nd activate this window before performing the key strokes to type "Hello Wo= rld". > But if you can unambiguously identify a running instance of something > and switch to it, then a method on the object that start() returns > would be absolutely correct. So I'd be looking at either your second > or fourth options from the original post. Those are also my favorites at the moment :) Michael www.getautoma.com