Providing 'default' value with raw_input()?

planetthoughtful planetthoughtful at gmail.com
Thu Dec 22 15:42:36 EST 2005


Bengt Richter wrote:
> On 22 Dec 2005 08:55:17 -0800, "planetthoughtful" <planetthoughtful at gmail.com> wrote:
>

> >I would like to include the ability to edit an existing value (drawn
> >from an SQLite table) using a DOS console Python app, but my gut
> >feeling from reading what I can find about raw_input() is that it only
> >allows you to provide a prompt, not a default value as well.
> >
> What's wrong with showing the default in the prompt itself? The thing is
> what user input in response should signify the default? E.g., maybe a single
> period by itself could mean "use the default" and nothing could mean "no change"
> and other input would be a new value.

Hi Bengt,

I think that would be a great solution if the value being 'edited' was
relatively short, or numeric, etc. But the values I want to 'edit' can
be several hundred characters long (ie they're text fields containing
todo notes), and using your method, I'd either accept the existing
value, or have to retype the text for that record. I think I mislead
people when I used the word 'default' -- I meant in the sense of being
able to edit the existing value, so that value, out of each record,
would be presented as the 'default', available for editing.

Sorry for the confusion.

Much warmth,

planetthoughtful




More information about the Python-list mailing list