Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > 10 sec poll - please reply!

Reply
Thread Tools

10 sec poll - please reply!

 
 
xDog Walker
Guest
Posts: n/a
 
      11-20-2012
On Tuesday 2012 November 20 08:29, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> To everyone else who has been so kind to reply thus far: What do you think
> of generate_keystrokes? It's a bit long but describes exactly what the
> function would be doing.


If not already offered and rejected,
how about enter() ?

--
Yonder nor sorghum stenches shut ladle gulls stopper torque wet
strainers.

 
Reply With Quote
 
 
 
 
Mark Lawrence
Guest
Posts: n/a
 
      11-20-2012
On 20/11/2012 17:40, (E-Mail Removed) wrote:
> I write a mfc application, then I want to use the python to test this application. just as user click that button. Please tell me how to write the python application?
>


Easy, open your favourite editor and start typing, what's the problem?

--
Cheers.

Mark Lawrence.

 
Reply With Quote
 
 
 
 
Alan Meyer
Guest
Posts: n/a
 
      11-20-2012
On 11/20/2012 11:29 AM, (E-Mail Removed) wrote:

> ... generate_keystrokes? ...


Not bad. "gen_keystrokes", or even "keystrokes" might also do.

I suggest using a name that is unique enough that you can grep through
piles of code and find where it's used. "type" fails that test.
"generate_keystrokes" passes with flying colors, but may be overkill.

Alan

 
Reply With Quote
 
Tim Chase
Guest
Posts: n/a
 
      11-21-2012
On 11/20/12 06:18, Michael Herrmann wrote:
> 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.


Just to add one more to the pot, Vim uses "feedkeys()" for a similar
purpose.

-tkc



 
Reply With Quote
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      11-21-2012
On Tue, 20 Nov 2012 07:18:42 -0800 (PST), Michael Herrmann
<(E-Mail Removed)> declaimed the following in
gmane.comp.python.general:

>
> Does that change your preference for 'send_keys'?
>


emit()
--
Wulfraed Dennis Lee Bieber AF6VN
(E-Mail Removed) HTTP://wlfraed.home.netcom.com/

 
Reply With Quote
 
Steven D'Aprano
Guest
Posts: n/a
 
      11-21-2012
On Tue, 20 Nov 2012 18:00:59 -0600, Tim Chase wrote:

> On 11/20/12 06:18, Michael Herrmann wrote:
>> 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.

>
> Just to add one more to the pot, Vim uses "feedkeys()" for a similar
> purpose.


What does it feed to the keys?

Hypercard and other XTalk languages use "type" to simulate typing.



--
Steven
 
Reply With Quote
 
Steven D'Aprano
Guest
Posts: n/a
 
      11-21-2012
On Tue, 20 Nov 2012 21:08:24 +0000, Prasad, Ramit wrote:

>> I believe that your initial instinct for the name of this function was
>> correct. It automates typing, so you should call it "type" or (for
>> those paranoid about shadowing the built-in, "type_str".
>>
>>

> I can too easily see somebody doing from module import * OR from module
> import type.


Yes. So what? If they do, then either they intended to do it, or they
will soon learn not to.

*Accidental* shadowing of names is a bad thing, because you get
unexpected bugs. *Deliberate* shadowing is not. We're all consenting
adults here, if somebody calls "from module import type", and shadows the
builtin type, that's their right to shoot themselves in the foot. Or not,
as the case may be.


--
Steven
 
Reply With Quote
 
Tim Chase
Guest
Posts: n/a
 
      11-21-2012
On 11/20/12 19:17, Steven D'Aprano wrote:
> On Tue, 20 Nov 2012 18:00:59 -0600, Tim Chase wrote:
>> Just to add one more to the pot, Vim uses "feedkeys()" for a similar
>> purpose.

>
> What does it feed to the keys?


In Vim's case, the signature would be something like

def feedkeys(str, mode='m'):
...

where the 'mode' parameter specifies whether keystrokes should be
passed through the key-remapping functionality, and whether they
should be treated as typed or as a mapping-unit (which affects undo
behavior, whether each key is undoable, or if it's undone as a chunk)

Vim has the advantage that feedkeys() only has to deal with the keys
that Vim sees, which doesn't distinguish keydown/keyup events, or
the presses of modifier keys.

> Hypercard and other XTalk languages use "type" to simulate typing.


However, I suspect that they don't _also_ have a type() function to
dynamically determine the class of an object (or, if they do, it's
called something other than type()

-tkc



 
Reply With Quote
 
Tim Chase
Guest
Posts: n/a
 
      11-21-2012
On 11/20/12 19:20, Steven D'Aprano wrote:
> *Accidental* shadowing of names is a bad thing, because you get
> unexpected bugs. *Deliberate* shadowing is not. We're all
> consenting adults here, if somebody calls "from module import
> type", and shadows the builtin type, that's their right to shoot
> themselves in the foot. Or not, as the case may be.


Python even allows you to unshoot your foot by doing

from module import type as unshadowed_type

So others can have your poorly-named cake and eat it too. Or some
such confuddling of aphorisms.

-tkc


 
Reply With Quote
 
Evan Driscoll
Guest
Posts: n/a
 
      11-21-2012
On 11/20/2012 05:46 PM, Alan Meyer wrote:
> On 11/20/2012 11:29 AM, (E-Mail Removed) wrote:
>
> > ... generate_keystrokes? ...

>
> Not bad. "gen_keystrokes", or even "keystrokes" might also do.

I would emphatically vote "no" for "keystrokes". That's a noun, not a
verb. What does it do? Tell you if its parameters are keystrokes?

(gen_keystrokes is fine, though personally I'd probably stick with
generate_keystrokes of the two.)

Evan
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Upgrade path: MCSA2000:Sec -> MCSA2003 -> MCSE2003:Sec ? The Rev [MCT] MCSE 0 12-13-2005 12:22 PM
Re: Upgrade path: MCSA2000:Sec -> MCSA2003 -> MCSE2003:Sec ? Bob Christian MCSE 1 12-13-2005 08:36 AM
Upgrade path: MCSA2000:Sec -> MCSA2003 -> MCSE2003:Sec ? =?Utf-8?B?QW1hbiBCLg==?= MCSE 0 12-13-2005 03:46 AM
No PAT from Higher Sec to Lower Sec interface Clemens Schwaighofer Cisco 0 10-20-2005 10:18 AM
Upgrade path: MCSA2000:Sec -> MCSA2003 -> MCSE2003:Sec ? =?Utf-8?B?QW1hbiBCLg==?= MCSE 4 09-07-2005 06:55 PM



Advertisments