10 sec poll - please reply!

Chris Angelico rosuav at gmail.com
Tue Nov 20 15:57:26 EST 2012


On Wed, Nov 21, 2012 at 3:21 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Tue, 20 Nov 2012 07:18:42 -0800, 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')
>
>
> "send_keys" is wrong, because you aren't sending keys. You're sending
> strings, except you aren't actually sending strings either, because
> "send" does not make sense without a target. You're automating the typing
> of strings, including control characters.

That depends on what the function actually does. If it sends a single
command to blat a string, including control characters, to the target,
then yes, it's sending a string. But if, as my reading of the OP tells
me, the last one is "send press-Ctrl, send press-a, send release-a,
send release-Ctrl", then it's sending keys, and the name should say
so. And it's this method that the key-sender in the Yosemite project
uses (though, for hysterical raisins, its function is called "dokey" -
which I am NOT recommending).

ChrisA



More information about the Python-list mailing list