Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16321
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!txtfeed1.tudelft.nl!tudelft.nl!txtfeed2.tudelft.nl!amsnews11.chello.com!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python.list@tim.thechases.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'interacting': 0.09; 'def': 0.13; '(whether': 0.16; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message-id:@tim.thechases.com': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'subject:asking': 0.16; 'subject:questions': 0.16; 'thanks,': 0.18; 'exists.': 0.18; 'input': 0.22; 'creating': 0.25; 'asking': 0.28; 'class': 0.29; 'subject:?': 0.31; 'header:User-Agent:1': 0.33; 'rather': 0.33; 'there': 0.33; 'to:addr:python-list': 0.34; 'something': 0.35; '...': 0.36; 'but': 0.37; "there's": 0.37; 'using': 0.38; 'answers': 0.38; 'skip:o 20': 0.38; "i'd": 0.39; 'hit': 0.40; 'to:addr:python.org': 0.40; 'more': 0.61; 'here:': 0.66; 'making': 0.67; 'entry)': 0.84 |
| Date | Mon, 28 Nov 2011 06:12:06 -0600 |
| From | Tim Chase <python.list@tim.thechases.com> |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16 |
| MIME-Version | 1.0 |
| To | Python <python-list@python.org> |
| Subject | cmd.Cmd asking questions? |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - boston.accountservergroup.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - tim.thechases.com |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3091.1322482335.27778.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1322482335 news.xs4all.nl 6965 [2001:888:2000:d::a6]:33425 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:16321 |
Show key headers only | View raw
Are there best-practices for creating wizards or asking various
questions (whether yes/no or text/numeric entry) in a cmd.Cmd
class? Something like the imaginary confirm() and get_string()
methods here:
class MyCmd(cmd.Cmd):
def do_name(self,line):
s = get_string(prompt=line, default="Whatever")
...
def do_save(self,line):
if os.path.isfile(line):
if not confirm("%r exists. Continue?", True): return
self.save(line)
def save(self, filename):
...
I can monkey with printing messages and using raw_input(), but
I'd like to know if there's a better way (such as something
interacting with readline for
text-entry-with-history-and-completion, or raw-character input
for Y/N answers rather than the need to hit <enter>, making it
feel more uniform),
Thanks,
-tkc
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
cmd.Cmd asking questions? Tim Chase <python.list@tim.thechases.com> - 2011-11-28 06:12 -0600
csiph-web