Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41870
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed3.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.017 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'read.': 0.03; 'matplotlib': 0.09; 'style.': 0.09; 'subject:design': 0.09; 'api': 0.11; 'cc:addr:python-list': 0.11; 'subject:Help': 0.11; 'python': 0.11; 'thread': 0.14; '"global"': 0.16; "'a',": 0.16; 'both,': 0.16; 'duplicates': 0.16; 'figure()': 0.16; 'nightmare.': 0.16; 'objects.': 0.16; 'scientists': 0.16; 'subject:API': 0.16; 'world!")': 0.16; 'example': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'accommodate': 0.24; 'example.': 0.24; 'helpful': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'point': 0.28; 'function': 0.29; 'correct': 0.29; 'mix': 0.30; '-----': 0.33; 'problem': 0.35; 'subject: (': 0.35; 'searching': 0.37; 'being': 0.38; 'thank': 0.38; 'window': 0.38; 'issue': 0.38; 'fact': 0.38; 'easy': 0.60; 'course': 0.61; "you're": 0.61; 'you.': 0.62; "you'll": 0.62; 'information': 0.63; 'our': 0.64; 'received:194': 0.64; 'become': 0.64; 'more': 0.64; 'great': 0.65; 'effectively': 0.66; 'notice:': 0.67; 'person,': 0.68; 'privileged.': 0.69; 'disclose': 0.74; 'zen': 0.84; 'medium.': 0.91; 'shell,': 0.91 |
| X-IronPort-AV | E=Sophos;i="4.87,352,1363129200"; d="scan'208";a="1315038" |
| X-Virus-Scanned | amavisd-new at zimbra.sequans.com |
| Date | Tue, 26 Mar 2013 11:07:45 +0100 (CET) |
| From | Jean-Michel Pichavant <jeanmichel@sequans.com> |
| To | Michael Herrmann <michael.herrmann@getautoma.com> |
| In-Reply-To | <68da956e-ebe0-4f58-92cd-f7ffff0075b4@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 |
| 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.3727.1364292472.2939.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1364292472 news.xs4all.nl 6911 [2001:888:2000:d::a6]:34706 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:41870 |
Show key headers only | View raw
----- 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')
>
> 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.
I think you're having the same issue that some other APIs, let's say matplotlib for example. They try to accommodate scientists (matlab) and programmers(python) by having a double API style.
One looks like
legend()
title()
plot()
save()
the other looks like
fig = figure()
fig.add_legend()
fig.title()
fig.plot()
fig.save()
The problem is, when searching for example on the net, you'll end up with a mix of both, it can become a nightmare.
I definitely prefer the later, for the reasons that have already been given to you in this thread and by the fact that with the correct (I)python shell, you can create your window object and get auto-completion on its methods just by hitting <tab>, very helpful when introspecting objects. Can be achieved of course in any python shell with function like dir() ; my point being that OOO design keeps things in their place, see the zen of python "Namespaces are one honking great idea -- let's do more of those!"
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 | Next — Next in thread | Find similar | Unroll thread
Re: Help me pick an API design (OO vs functional) Jean-Michel Pichavant <jeanmichel@sequans.com> - 2013-03-26 11:07 +0100
Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 04:52 -0700
Re: Help me pick an API design (OO vs functional) Chris Angelico <rosuav@gmail.com> - 2013-03-26 22:57 +1100
Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 05:20 -0700
Re: Help me pick an API design (OO vs functional) Michael Herrmann <michael.herrmann@getautoma.com> - 2013-03-26 04:52 -0700
csiph-web