Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41888 > unrolled thread
| Started by | Jean-Michel Pichavant <jeanmichel@sequans.com> |
|---|---|
| First post | 2013-03-26 13:16 +0100 |
| Last post | 2013-03-26 05:27 -0700 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
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
| From | Jean-Michel Pichavant <jeanmichel@sequans.com> |
|---|---|
| Date | 2013-03-26 13:16 +0100 |
| Subject | Re: Help me pick an API design (OO vs functional) |
| Message-ID | <mailman.3739.1364300218.2939.python-list@python.org> |
----- 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.
[toc] | [next] | [standalone]
| From | Michael Herrmann <michael.herrmann@getautoma.com> |
|---|---|
| Date | 2013-03-26 05:27 -0700 |
| Message-ID | <d84e6129-ee98-4904-a198-13e74f99237e@googlegroups.com> |
| In reply to | #41888 |
On Tuesday, March 26, 2013 1:16:56 PM 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.
> >
Ah, so you meant "is also easy to read" ;) I agree but the example with global functions is even easier to read. I guess I am being pretty anal about these issues, but I see every unnecessary syntax we can save as a win.
> [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.
I see. I know you prefer design #1 but that would at least place design #4 over #3, right?
Thanks.
Michael
www.getautoma.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web