Re: Input() in Python3

2011-04-25 Thread Mel
Westley Martínez wrote: On Fri, Apr 22, 2011 at 10:08:20AM -0400, Mel wrote: [ ... ] But sys.exit() doesn't return a string. My fave is Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for more information. import sys a =

Re: Input() in Python3

2011-04-25 Thread Jayme Proni Filho
Hey! Try to use like this: http://sprunge.us/RcYb change values for understanding code. Good ideas guys! --- Jayme Proni Filho Skype: jaymeproni Twitter: @jaymeproni Phone: +55 - 17 - 3631 - 6576 Mobile: +55 -

Re: Input() in Python3

2011-04-23 Thread Westley Martínez
On Fri, Apr 22, 2011 at 10:08:20AM -0400, Mel wrote: Westley Martínez wrote: On Fri, Apr 22, 2011 at 04:49:19PM +1000, Chris Angelico wrote: U NO. NO NO NO. What if someone enters os.exit() as their number? You shouldn't eval() unchecked user input! Chris Angelico Right,

Re: Input() in Python3

2011-04-23 Thread harrismh777
Chris Rebert wrote: Well, it pretty much*was* totally removed; it was prone to misuse and had very few legitimate uses. It's just that raw_input() also got renamed simultaneously. What were you using it for? There are often much better alternatives. For the purpose pretty much described in

Input() in Python3

2011-04-22 Thread harrismh777
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

Re: Input() in Python3

2011-04-22 Thread Chris Angelico
On Fri, Apr 22, 2011 at 4:22 PM, harrismh777 harrismh...@charter.net wrote: now we get this for input():   raw_input(prompt) -- string I would have to say that the 2.x behaviour of input() is a mistake that's being corrected in 3.x. With a simple name like input(), it should do something

Re: Input() in Python3

2011-04-22 Thread Chris Angelico
On Fri, Apr 22, 2011 at 4:49 PM, Chris Angelico ros...@gmail.com wrote: U NO. NO NO NO. What if someone enters os.exit() as their number? You shouldn't eval() unchecked user input! Whoops, I meant sys.exit() - but you probably knew that already. ChrisA --

Re: Input() in Python3

2011-04-22 Thread Chris Rebert
On Thu, Apr 21, 2011 at 11:22 PM, harrismh777 harrismh...@charter.net wrote: 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

Re: Input() in Python3

2011-04-22 Thread Westley Martínez
On Fri, Apr 22, 2011 at 04:49:19PM +1000, Chris Angelico wrote: On Fri, Apr 22, 2011 at 4:22 PM, harrismh777 harrismh...@charter.net wrote: now we get this for input():   raw_input(prompt) -- string I would have to say that the 2.x behaviour of input() is a mistake that's being

Re: Input() in Python3

2011-04-22 Thread Mel
Westley Martínez wrote: On Fri, Apr 22, 2011 at 04:49:19PM +1000, Chris Angelico wrote: U NO. NO NO NO. What if someone enters os.exit() as their number? You shouldn't eval() unchecked user input! Chris Angelico Right, there's no way to check you're getting a number, however

Re: Input() in Python3

2011-04-22 Thread Benjamin Kaplan
On Apr 22, 2011 10:12 AM, Mel mwil...@the-wire.com wrote: Westley Martínez wrote: On Fri, Apr 22, 2011 at 04:49:19PM +1000, Chris Angelico wrote: U NO. NO NO NO. What if someone enters os.exit() as their number? You shouldn't eval() unchecked user input! Chris Angelico

Re: Input() in Python3

2011-04-22 Thread Chris Angelico
On Sat, Apr 23, 2011 at 12:08 AM, Mel mwil...@the-wire.com wrote: But sys.exit() doesn't return a string.  My fave is It doesn't return _at all_. Boom, process terminated. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: Input() in Python3

2011-04-22 Thread Steven D'Aprano
On Sat, 23 Apr 2011 06:25:51 +1000, Chris Angelico wrote: On Sat, Apr 23, 2011 at 12:08 AM, Mel mwil...@the-wire.com wrote: But sys.exit() doesn't return a string.  My fave is It doesn't return _at all_. Boom, process terminated. Technically it raises an exception, which can then be caught

Re: Input() in Python3

2011-04-22 Thread Chris Angelico
On Sat, Apr 23, 2011 at 9:55 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 23 Apr 2011 06:25:51 +1000, Chris Angelico wrote: On Sat, Apr 23, 2011 at 12:08 AM, Mel mwil...@the-wire.com wrote: But sys.exit() doesn't return a string.  My fave is It doesn't return _at