Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   10 sec poll - please reply! (http://www.velocityreviews.com/forums/t954667-10-sec-poll-please-reply.html)

Michael Herrmann 11-20-2012 12:18 PM

10 sec poll - please reply!
 
Hi,

I'm developing a GUI Automation library (http://www.getautoma.com) and am having difficulty picking a name for the function that simulates key strokes.. I currently have it as 'type' but that clashes with the built-in function.. Example uses of 'type':

type(ENTER)

type("Hello World!")

type(CTRL + 'a')

What, in your view, would be the most intuitive alternative name?

Here are my thoughts so far: I could call it 'press' but then our GUI automation tool also allows you to click things and then "press" might be mistaken for "pressing a button". A less ambiguous alternative is "type_keys" butthat is rather long and doesn't read as well, for instance in type_keys(ENTER).

Thank you very much!

Chris Angelico 11-20-2012 12:23 PM

Re: 10 sec poll - please reply!
 
On Tue, Nov 20, 2012 at 11:18 PM, Michael Herrmann
<michael.herrmann@getautoma.com> wrote:
> Hi,
>
> I'm developing a GUI Automation library (http://www.getautoma.com) and am having difficulty picking a name for the function that simulates key strokes. I currently have it as 'type' but that clashes with the built-in function. Example uses of 'type':
>
> type(ENTER)
>
> type("Hello World!")
>
> type(CTRL + 'a')
>
> What, in your view, would be the most intuitive alternative name?


I've done similar things under names like "send_keys".

ChrisA

Steven D'Aprano 11-20-2012 01:09 PM

Re: 10 sec poll - please reply!
 
You know, you would probably get more responses if you picked a
descriptive subject line that didn't look like spam. I only read your
post because I accidentally clicked on it.

On Tue, 20 Nov 2012 04:18:38 -0800, Michael Herrmann wrote:

> I'm developing a GUI Automation library (http://www.getautoma.com) and


By the way, your website is down.


> am having difficulty picking a name for the function that simulates key
> strokes. I currently have it as 'type' but that clashes with the
> built-in function. Example uses of 'type':
>
> type(ENTER)
> type("Hello World!")
> type(CTRL + 'a')
>
> What, in your view, would be the most intuitive alternative name?



I'd keep the name as "type". It exists in a different namespace to the
builtin, so people have a choice: they can refer to the fully-qualified
name, or not, as they prefer. I don't know the name of your module, since
your website is down, but let's say it's called "automata":

# Option 1
import automata
automata.type("Hello World")


# Option 2
from automata import type
type("Hello World"
import builtins # in Python 2 use __builtin__ instead
builtins.type([])



So the name clash doesn't matter.



--
Steven

Michael Herrmann 11-20-2012 01:17 PM

Re: 10 sec poll - please reply!
 
Hi,

thank you for your replies. So far two people said 'send_keys' and one person said 'type'.

Steven, thanks for your reply. Sorry if the message title disturbed you. Mypersonal feelings aren't too strongly against 'type' either, but then I'm afraid it might bother more experienced Python programmers who are used to a very different meaning of 'type'. Do you think that could be a problem?

Thanks again to all who have replied,
Michael

On Tuesday, November 20, 2012 1:18:38 PM UTC+1, Michael Herrmann wrote:
> Hi,
>
>
>
> I'm developing a GUI Automation library (http://www.getautoma.com) and amhaving difficulty picking a name for the function that simulates key strokes. I currently have it as 'type' but that clashes with the built-in function. Example uses of 'type':
>
>
>
> type(ENTER)
>
>
>
> type("Hello World!")
>
>
>
> type(CTRL + 'a')
>
>
>
> What, in your view, would be the most intuitive alternative name?
>
>
>
> Here are my thoughts so far: I could call it 'press' but then our GUI automation tool also allows you to click things and then "press" might be mistaken for "pressing a button". A less ambiguous alternative is "type_keys" but that is rather long and doesn't read as well, for instance in type_keys(ENTER).
>
>
>
> Thank you very much!



Michael Herrmann 11-20-2012 01:20 PM

Re: 10 sec poll - please reply!
 
P.S.: The website is back online; our hosting provider was having technicalproblems...

On Tuesday, November 20, 2012 1:18:38 PM UTC+1, Michael Herrmann wrote:
> Hi,
>
>
>
> I'm developing a GUI Automation library (http://www.getautoma.com) and amhaving difficulty picking a name for the function that simulates key strokes. I currently have it as 'type' but that clashes with the built-in function. Example uses of 'type':
>
>
>
> type(ENTER)
>
>
>
> type("Hello World!")
>
>
>
> type(CTRL + 'a')
>
>
>
> What, in your view, would be the most intuitive alternative name?
>
>
>
> Here are my thoughts so far: I could call it 'press' but then our GUI automation tool also allows you to click things and then "press" might be mistaken for "pressing a button". A less ambiguous alternative is "type_keys" but that is rather long and doesn't read as well, for instance in type_keys(ENTER).
>
>
>
> Thank you very much!



Dave Angel 11-20-2012 01:39 PM

Re: 10 sec poll - please reply!
 
On 11/20/2012 07:18 AM, Michael Herrmann wrote:
> Hi,
>
> I'm developing a GUI Automation library (http://www.getautoma.com) and am having difficulty picking a name for the function that simulates key strokes. I currently have it as 'type' but that clashes with the built-in function. Example uses of 'type':
>
> type(ENTER)
>
> type("Hello World!")
>
> type(CTRL + 'a')
>
> What, in your view, would be the most intuitive alternative name?
>
> Here are my thoughts so far: I could call it 'press' but then our GUI automation tool also allows you to click things and then "press" might be mistaken for "pressing a button". A less ambiguous alternative is "type_keys" but that is rather long and doesn't read as well, for instance in type_keys(ENTER).
>
> Thank you very much!


I also vote for send_keys(), even before I saw Chris' reply.

'type' is too overloaded a word. For example, in Windows, it's the
command to display the contents of a file - it types it to the screen.



Neil Cerutti 11-20-2012 02:39 PM

Re: 10 sec poll - please reply!
 
On 2012-11-20, Dave Angel <davea@dejaviewphoto.com> wrote:
> I also vote for send_keys(), even before I saw Chris' reply.
>
> 'type' is too overloaded a word. For example, in Windows, it's
> the command to display the contents of a file - it types it to
> the screen.


type is a nice verb, but since it's also a well-used noun it's
perhaps not quite as good as send.

--
Neil Cerutti

Michael Herrmann 11-20-2012 03:18 PM

Re: 10 sec poll - please reply!
 
Thanks again for your further replies. So far, it's 4 votes for 'send_keys'and 1 vote for 'type'.

Regarding 'send_keys': To me personally it makes sense to send keys _to_ something. However, in our API, send_keys would not be called on an object orwith a parameter indicating the target. It would just be

send_keys(ENTER)
send_keys("Hello World!")
send_keys(CTRL + 'a')

Does that change your preference for 'send_keys'?

Thanks a lot!!!

On Tuesday, November 20, 2012 1:18:38 PM UTC+1, Michael Herrmann wrote:
> Hi,
>
>
>
> I'm developing a GUI Automation library (http://www.getautoma.com) and amhaving difficulty picking a name for the function that simulates key strokes. I currently have it as 'type' but that clashes with the built-in function. Example uses of 'type':
>
>
>
> type(ENTER)
>
>
>
> type("Hello World!")
>
>
>
> type(CTRL + 'a')
>
>
>
> What, in your view, would be the most intuitive alternative name?
>
>
>
> Here are my thoughts so far: I could call it 'press' but then our GUI automation tool also allows you to click things and then "press" might be mistaken for "pressing a button". A less ambiguous alternative is "type_keys" but that is rather long and doesn't read as well, for instance in type_keys(ENTER).
>
>
>
> Thank you very much!



MRAB 11-20-2012 03:59 PM

Re: 10 sec poll - please reply!
 
On 2012-11-20 15:18, Michael Herrmann wrote:
> Thanks again for your further replies. So far, it's 4 votes for 'send_keys' and 1 vote for 'type'.
>
> Regarding 'send_keys': To me personally it makes sense to send keys _to_ something. However, in our API, send_keys would not be called on an object or with a parameter indicating the target. It would just be
>
> send_keys(ENTER)
> send_keys("Hello World!")
> send_keys(CTRL + 'a')
>
> Does that change your preference for 'send_keys'?
>

Calling it "send_keys" does have precedent.

There's a module called SendKeys which uses the SendKeys system call in
Windows. Unfortunately, the last version was for Python 2.6.

When I wanted the functionality for Python 3.3 I had to write my own.

John Gordon 11-20-2012 04:09 PM

Re: 10 sec poll - please reply!
 
In <3d71f175-164e-494c-a521-2eaa5679b524@googlegroups.com> Michael Herrmann <michael.herrmann@getautoma.com> writes:

> What, in your view, would be the most intuitive alternative name?


keyboard_input().

--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"



All times are GMT. The time now is 02:40 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.