10 sec poll - please reply!

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Nov 20 08:09:04 EST 2012


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



More information about the Python-list mailing list