Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26402
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <phihag@phihag.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'arguments': 0.07; 'try:': 0.07; 'python': 0.09; 'beginners': 0.09; 'input,': 0.09; 'invocation': 0.09; 'nameerror:': 0.09; 'solution,': 0.09; 'cc:addr:python-list': 0.10; 'language,': 0.11; 'curses': 0.16; 'eckhardt': 0.16; 'filename:fname piece:signature': 0.16; 'scripts.': 0.16; 'think?': 0.16; 'wrote:': 0.17; 'input': 0.18; 'cc:2**0': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'pass': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'raw': 0.27; 'probably': 0.29; 'function': 0.30; 'running': 0.32; 'received:192.168.2': 0.34; 'generic': 0.35; 'except': 0.36; 'subject:: ': 0.38; 'received:192': 0.39; 'short': 0.39; 'received:192.168': 0.40; 'choice.': 0.93; 'serious': 0.98 |
| Date | Thu, 02 Aug 2012 13:07:59 +0200 |
| From | Philipp Hagemeister <phihag@phihag.de> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.5) Gecko/20120624 Icedove/10.0.5 |
| MIME-Version | 1.0 |
| To | Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> |
| Subject | Re: consistent input() for Python 2 and 3 |
| References | <72vpe9-kki.ln1@satorlaser.homedns.org> |
| In-Reply-To | <72vpe9-kki.ln1@satorlaser.homedns.org> |
| X-Enigmail-Version | 1.4 |
| OpenPGP | id=FAFB085C |
| Content-Type | multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig2B381152445C0835EC2A4281" |
| Cc | python-list@python.org |
| 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.2870.1343905697.4697.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1343905697 news.xs4all.nl 6886 [2001:888:2000:d::a6]:42391 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:26402 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On 08/02/2012 11:49 AM, Ulrich Eckhardt wrote: > try: > # redirect input() to raw_input() like Python 3 > input = raw_input > except NameError: > # no raw input, probably running Python 3 already > pass > What do you think? Any better alternatives? That's the generic solution, see http://python3porting.com/differences.html#input-and-raw-input . In my experience, it seems that input's main function is to allow beginners to learn the language, or to be used in short scripts. For a serious application, either curses or moving the input to the invocation arguments is often a better choice. - Philipp
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
consistent input() for Python 2 and 3 Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-08-02 11:49 +0200 Re: consistent input() for Python 2 and 3 Philipp Hagemeister <phihag@phihag.de> - 2012-08-02 13:07 +0200
csiph-web