Message169248
| Author |
simpkins |
| Recipients |
Arfrever, georg.brandl, loewis, simpkins, vstinner |
| Date |
2012年08月28日.03:23:41 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1346124222.32.0.617662222379.issue15785@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> + Get a wide character as (is_key_code, key). *is_key_code* is True for
> + function keys, keypad keys and so, in this case, *key* is a multibyte string
> + containing the key name. Otherwise, *key* is a single character
> + corresponding to the key.
The curses module already exposes the integer KEY_* constants. I think the
API would be easier to use if it simply returned the integer keycode constant
rather than returning the human-readable name returned by keyname().
I suspect most callers will want to compare the keycode against one of these
KEY_* constants to see what type of key was pressed so they can take action on
specific keys. Comparing the return value against one of the curses.KEY_*
constants seems easier than having to compare it to the result of
curses.keyname(curses.KEY_*)
The curses module also already exposes the keyname() function if callers do
want to get the human-readable string for an integer keycode.
If the function returned either a single-character unicode string or an integer
keycode, this would also make it possible to completely drop the is_key_code
part of the return value. (Callers could simply check the type of the return
value to see if it is a keycode.) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年08月28日 03:23:42 | simpkins | set | recipients:
+ simpkins, loewis, georg.brandl, vstinner, Arfrever |
| 2012年08月28日 03:23:42 | simpkins | set | messageid: <1346124222.32.0.617662222379.issue15785@psf.upfronthosting.co.za> |
| 2012年08月28日 03:23:41 | simpkins | link | issue15785 messages |
| 2012年08月28日 03:23:41 | simpkins | create |
|