Converting a string to the most probable type
Lie.1296 at gmail.com
Sun Mar 16 19:04:59 CET 2008
On Mar 11, 4:15 am, John Machin <sjmac... at lexicon.net> wrote:
> On Mar 11, 3:19 am, cokofree... at gmail.com wrote:
> > The trick in the case of when you do not want to guess, or the choices
> > grow too much, is to ask the user to tell you in what format they want
> > it and format according to their wishes.
> > Neatly avoids too much guessing and isn't much extra to add.
> The plot is about understanding input, not formatting output.
And what he meant is simply to make an agreement with the user on how
he/she would format his/her input and to disallow input from formats
that haven't been agreed to avoid guessing. That is the cleanest and
most polite solution, although I'd suspect it would be considered less
user friendly by regular user although power user would be most happy
More information about the Python-list