Author: leogregianin choice2 = wikipedia.inputChoice(u'Change the page title to "%s"?' % newPageTitle, ['yes', 'no', 'all', 'quit'], ['y', 'n', 'a', 'q'])
On Saturday 15 September 2007 23:08:16 Merlijn van Deen wrote:
What's the point of the 'no', as it should never be returned?
There is none, comparing the choice to 'n' is enough.
On a side note; does anyone have suggestions for the inputChoice format? Is the current inputChoice(text, choices, keys, default) the preferred one, and is the 'N' or 'n' output the preferred one?
When I wrote it, my intention was to show what's the default by capitalizing that character. This is the way it's done in many command-line tools, for example apt-get.
However, this makes i18n hard: for example, in German, all nouns are capitalized, so the english 'show [l]ist' becomes '[L]iste anzeigen', making L look like the default hotkey.
As we now have proper colorization support on nearly all platforms (the only exception I know of is Python 2.4 or lower on Windows), we could instead use colors to indicate the default choice, e.g.:
choice2 = wikipedia.inputChoice(u'Continue?', ['yes', 'no'], ['y', 'n'], 'n')
Would give:
Continue? ([y]es, [n]o)
Where the n is printed in blue.
We could also try to get rid of the square brackets, for example (yes, no) with the y in low-saturation blue and the n in high-saturation blue. But that would require lots of testing, to make sure that this doesn't reduce usability on any system.
Daniel