Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3842
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!209.197.12.246.MISMATCH!nx02.iad01.newshosting.com!209.197.12.242.MISMATCH!nx01.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe09.iad.POSTED!00000000!not-for-mail |
|---|---|
| From | harrismh777 <harrismh777@charter.net> |
| User-Agent | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20101206 SeaMonkey/2.0.11 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.python |
| Subject | Input() in Python3 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Lines | 37 |
| Message-ID | <I89sp.39115$yp3.5013@newsfe09.iad> (permalink) |
| NNTP-Posting-Host | niopnfljcojmkdanmnaegncbjbibikog |
| X-Complaints-To | abuse@charter.net |
| X-Trace | gbibggbfamgkfdioffhhjjcnmknpkahnddhmnddjbgfkpifaniopnfljcojmkdanpmcnpmojlebeflnbhibdpffknbniapakokagedkjehniifpcdokmghcholgbnjipplepgefcpbbnokgh |
| NNTP-Posting-Date | Fri, 22 Apr 2011 06:22:32 UTC |
| Date | Fri, 22 Apr 2011 01:22:32 -0500 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:3842 |
Show key headers only | View raw
My interactive scripts are giving errors on the input(). I discovered
another fairly significant change in Python3, as discussed in PEP 3111.
I was a little flabbergasted to discover that input() was proposed to be
removed 'totally' from 3000. Of course I agree with PEP 3111 and am
thankful that input() is still a built-in. doh.
The problem is that the behavior was significantly changed, again,
causing existing code to break un-necessarily. So, input() used to be
equivalent to:
eval(raw_input("prompt>")) --> value
now we get this for input():
raw_input("prompt>") --> string
I'm not whining or anything, just wondering why? Could someone enlighten
me please?
Anyway, it looks like the best fix for 2.x --> 3.x code changes:
change: a = input("enter a number > ")
to: a = eval(input("enter a number > "))
Again, this is just another example where leaving the advertised
interface alone would have made more sense... unless of course, I'm
missing something important here.
kind regards,
m harris
Back to comp.lang.python | Previous | Next — Next in thread | Find similar
Input() in Python3 harrismh777 <harrismh777@charter.net> - 2011-04-22 01:22 -0500
Re: Input() in Python3 Chris Angelico <rosuav@gmail.com> - 2011-04-22 16:49 +1000
Re: Input() in Python3 Chris Angelico <rosuav@gmail.com> - 2011-04-22 16:50 +1000
Re: Input() in Python3 Chris Rebert <clp2@rebertia.com> - 2011-04-22 00:46 -0700
Re: Input() in Python3 harrismh777 <harrismh777@charter.net> - 2011-04-23 20:03 -0500
Re: Input() in Python3 Westley Martínez <anikom15@gmail.com> - 2011-04-22 06:52 -0700
Re: Input() in Python3 Mel <mwilson@the-wire.com> - 2011-04-22 10:08 -0400
Re: Input() in Python3 Chris Angelico <rosuav@gmail.com> - 2011-04-23 06:25 +1000
Re: Input() in Python3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-22 23:55 +0000
Re: Input() in Python3 Chris Angelico <rosuav@gmail.com> - 2011-04-23 10:07 +1000
Re: Input() in Python3 Westley Martínez <anikom15@gmail.com> - 2011-04-23 12:33 -0700
Re: Input() in Python3 Mel <mwilson@the-wire.com> - 2011-04-25 12:50 -0400
csiph-web