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


Groups > comp.lang.python > #41888

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

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=790bc2fab=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.079
X-Spam-Evidence '*H*': 0.85; '*S*': 0.00; 'read.': 0.03; 'cc:addr:googlegroups.com': 0.09; 'namespace': 0.09; 'subject:design': 0.09; 'cc:addr:python-list': 0.11; 'subject:Help': 0.11; '"global"': 0.16; "'a',": 0.16; 'does,': 0.16; 'duplicates': 0.16; 'subject:API': 0.16; 'world!")': 0.16; 'wrote:': 0.18; 'pointed': 0.19; 'example': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; "doesn't": 0.30; 'reply.': 0.31; 'names.': 0.31; '-----': 0.33; 'problem': 0.35; 'subject: (': 0.35; 'but': 0.35; 'object,': 0.36; 'method': 0.36; 'useful': 0.36; 'thanks': 0.36; 'thank': 0.38; 'easy': 0.60; 'march': 0.61; 'you.': 0.62; 'information': 0.63; 'our': 0.64; 'received:194': 0.64; 'effectively': 0.66; 'notice:': 0.67; 'yes': 0.68; '26,': 0.68; 'person,': 0.68; 'privileged.': 0.69; 'to,': 0.72; 'disclose': 0.74; 'completion': 0.78; ':).': 0.84; 'medium.': 0.91; '2013': 0.98
X-IronPort-AV E=Sophos;i="4.87,352,1363129200"; d="scan'208";a="1315618"
X-Virus-Scanned amavisd-new at zimbra.sequans.com
Date Tue, 26 Mar 2013 13:16:56 +0100 (CET)
From Jean-Michel Pichavant <jeanmichel@sequans.com>
To Michael Herrmann <michael.herrmann@getautoma.com>
In-Reply-To <dd54c915-9c81-4fa2-8b4a-99e8b45a2f5d@googlegroups.com>
Subject Re: Help me pick an API design (OO vs functional)
MIME-Version 1.0
X-Mailer Zimbra 7.2.2_GA_2852 (ZimbraWebClient - GC7 (Linux)/7.2.2_GA_2852)
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding base64
Cc python-list@python.org, comp lang python <comp.lang.python@googlegroups.com>
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.3739.1364300218.2939.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1364300218 news.xs4all.nl 6955 [2001:888:2000:d::a6]:50816
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41888

Show key headers only | View raw



----- Original Message -----
> On Tuesday, March 26, 2013 11:07:45 AM UTC+1, Jean-Michel Pichavant
> wrote:
> > ----- Original Message -----
> > > 	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')
> > > 

             ^
             |
          here, this is an above example :D

> > > The problem with this design is that it effectively duplicates
> > > our
> > > API: We want to keep our "global" functions because they are so
> > > easy
> > > to read.
> > 
> > So is the example above. This is the best solution in my opinion.
> 
> Thanks for your reply. What do you mean by "So is the example above"
> though?

Well the example above :).

 
[snip]
> Doesn't the IPython do auto-completion for "global" functions?

Yes it does, but as Chris pointed out, your global/module namespace will be "polluted" by a lot of names.
By using completion on an object, you get the method it has access to, which is very useful to narrow down what you can do with it.

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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


Thread

Re: Help me pick an API design (OO vs functional) Jean-Michel Pichavant <jeanmichel@sequans.com> - 2013-03-26 13:16 +0100
  Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 05:27 -0700

csiph-web