Adam Simpkins added the comment:

> +   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.)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15785>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to