10 sec poll - please reply!

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Nov 23 23:30:03 CET 2012

On Fri, 23 Nov 2012 05:42:22 -0800, Michael Herrmann wrote:

> Dear all,
> the emails are getting kind of long so to ask you briefly: What do you
> think of splitting `type` into two functions `press` and `enter`?

This invites confusion as to the rules of when you can call `press` and 
when you can call `enter`. Especially since you haven't explained the 
rules, just given a bunch of non-exhaustive examples and invited people 
to extrapolate what the rules are.

(By the way, they aren't use-cases, they're examples.)

> Their use cases are:
>         press(CTRL + 'a')
>         press(ENTER)
>         press(ALT + 'f', 's')
>         enter("Hello World!")
>         enter("test.txt", into="File name")

Is `press('s')` allowed?

What about `press('S')`, or do I have to write `press(SHIFT + 's')`?

If I can write `press(ALT + 'f', 's')`, can I write `press('f', 's')`? If 
not, why not?

Can I write `press('fs')` as a simpler version of `press('f', 's')`? If 
not, why not?

Can I write `press(CTRL + 'i')` to get a tab? How about `press('\t')`?

If I want three tabs, can I write `press('\t\t\t')`, or do I have to write

press(CTRL + 'i')
press(CTRL + 'i')
press(CTRL + 'i')

If I want a tab, a letter, and a newline, repeated three times, can I do 


Or do I have to do this?

press(CTRL + 'i')
press(CTRL + 'i')
press(CTRL + 'i')

Speaking of enter, how do I type "Hello World!" without entering it? If I 
want to type "Hello World!" without ENTER, do I have to do this?

... you get the picture

With a function named "press", I would expect to be able to say:


How do I do something like that?


More information about the Python-list mailing list