Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64244 > unrolled thread

question about input() and/or raw_input()

Started byRoy Smith <roy@panix.com>
First post2014-01-18 13:30 -0500
Last post2014-01-19 13:22 -0700
Articles 14 on this page of 34 — 13 participants

Back to article view | Back to comp.lang.python


Contents

  question about input() and/or raw_input() Roy Smith <roy@panix.com> - 2014-01-18 13:30 -0500
    Re: question about input() and/or raw_input() Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-18 18:41 +0000
    Re: question about input() and/or raw_input() Emile van Sebille <emile@fenx.com> - 2014-01-18 10:49 -0800
    Re: question about input() and/or raw_input() Peter Otten <__peter__@web.de> - 2014-01-18 20:05 +0100
    Re: question about input() and/or raw_input() Terry Reedy <tjreedy@udel.edu> - 2014-01-18 16:33 -0500
      Re: question about input() and/or raw_input() Grant Edwards <invalid@invalid.invalid> - 2014-01-19 16:14 +0000
        Re: question about input() and/or raw_input() Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-19 12:12 -0500
          Re: question about input() and/or raw_input() Grant Edwards <invalid@invalid.invalid> - 2014-01-19 17:42 +0000
            Re: question about input() and/or raw_input() Chris Angelico <rosuav@gmail.com> - 2014-01-20 04:59 +1100
    Re: question about input() and/or raw_input() Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-18 21:17 -0500
    Re: question about input() and/or raw_input() Chris Angelico <rosuav@gmail.com> - 2014-01-19 13:46 +1100
    Re: question about input() and/or raw_input() Rustom Mody <rustompmody@gmail.com> - 2014-01-18 20:15 -0800
      Re: question about input() and/or raw_input() Chris Angelico <rosuav@gmail.com> - 2014-01-19 15:21 +1100
        Re: question about input() and/or raw_input() Rustom Mody <rustompmody@gmail.com> - 2014-01-18 20:43 -0800
          Re: question about input() and/or raw_input() Chris Angelico <rosuav@gmail.com> - 2014-01-19 15:59 +1100
            Re: question about input() and/or raw_input() Rustom Mody <rustompmody@gmail.com> - 2014-01-19 00:26 -0800
              Re: question about input() and/or raw_input() Chris Angelico <rosuav@gmail.com> - 2014-01-19 21:39 +1100
              Re: question about input() and/or raw_input() Ethan Furman <ethan@stoneleaf.us> - 2014-01-19 08:14 -0800
              Re: question about input() and/or raw_input() Chris Angelico <rosuav@gmail.com> - 2014-01-20 03:38 +1100
              Re: question about input() and/or raw_input() Ethan Furman <ethan@stoneleaf.us> - 2014-01-19 09:50 -0800
              Re: question about input() and/or raw_input() Chris Angelico <rosuav@gmail.com> - 2014-01-20 05:41 +1100
              Re: question about input() and/or raw_input() Ethan Furman <ethan@stoneleaf.us> - 2014-01-19 11:16 -0800
    Re: question about input() and/or raw_input() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-19 06:24 +0000
    Re: question about input() and/or raw_input() Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-19 18:07 +0000
      Re: question about input() and/or raw_input() Grant Edwards <invalid@invalid.invalid> - 2014-01-19 18:15 +0000
        Re: question about input() and/or raw_input() Roy Smith <roy@panix.com> - 2014-01-19 13:37 -0500
          Re: question about input() and/or raw_input() Chris Angelico <rosuav@gmail.com> - 2014-01-20 05:43 +1100
          Re: question about input() and/or raw_input() Grant Edwards <invalid@invalid.invalid> - 2014-01-19 19:11 +0000
          Re: question about input() and/or raw_input() Gene Heskett <gheskett@wdtv.com> - 2014-01-19 15:09 -0500
        Re: question about input() and/or raw_input() Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-19 19:17 +0000
        Re: question about input() and/or raw_input() Larry Martell <larry.martell@gmail.com> - 2014-01-19 12:24 -0700
        Re: question about input() and/or raw_input() Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-19 19:29 +0000
    Re: question about input() and/or raw_input() Gene Heskett <gheskett@wdtv.com> - 2014-01-19 15:12 -0500
    Re: question about input() and/or raw_input() Larry Martell <larry.martell@gmail.com> - 2014-01-19 13:22 -0700

Page 2 of 2 — ← Prev page 1 [2]


#64307

FromChris Angelico <rosuav@gmail.com>
Date2014-01-20 05:41 +1100
Message-ID<mailman.5714.1390156904.18130.python-list@python.org>
In reply to#64287
On Mon, Jan 20, 2014 at 4:50 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
> The difference I was thinking of is:
>
>   "%h" % 3.14  # this works
>
> vs.
>
>   hex(3.14)  # this raises
>
> In 3.5 both will raise.

Now you have me *thoroughly* intrigued. It's not %h (incomplete format
- h is a modifier), nor %H (unsupported format character). Do you mean
%x? As of 3.4.0b2, that happily truncates a float:

>>> "%x" % 3.14
'3'

Is that changing in 3.5? Seems a relatively insignificant point, tbh!
Anyway, no biggie.

ChrisA

[toc] | [prev] | [next] | [standalone]


#64320

FromEthan Furman <ethan@stoneleaf.us>
Date2014-01-19 11:16 -0800
Message-ID<mailman.5723.1390160182.18130.python-list@python.org>
In reply to#64287
On 01/19/2014 10:41 AM, Chris Angelico wrote:
> On Mon, Jan 20, 2014 at 4:50 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
>> The difference I was thinking of is:
>>
>>    "%h" % 3.14  # this works
>>
>> vs.
>>
>>    hex(3.14)  # this raises
>>
>> In 3.5 both will raise.
>
> Now you have me *thoroughly* intrigued. It's not %h (incomplete format
> - h is a modifier), nor %H (unsupported format character). Do you mean
> %x? As of 3.4.0b2, that happily truncates a float:
>
>>>> "%x" % 3.14
> '3'
>
> Is that changing in 3.5? Seems a relatively insignificant point, tbh!

Argh.  Yes, %x or %X.

--
~Ethan~

[toc] | [prev] | [next] | [standalone]


#64282

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2014-01-19 06:24 +0000
Message-ID<52db6f98$0$29999$c3e8da3$5496439d@news.astraweb.com>
In reply to#64244
On Sat, 18 Jan 2014 13:30:20 -0500, Roy Smith wrote:

> Pardon me for being cynical, but in the entire history of the universe,
> has anybody ever used input()/raw_input() for anything other than a
> homework problem?

Yes. They are excellent for interactive command line tools.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#64303

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-01-19 18:07 +0000
Message-ID<mailman.5712.1390154886.18130.python-list@python.org>
In reply to#64244
On 18/01/2014 18:41, Mark Lawrence wrote:
> On 18/01/2014 18:30, Roy Smith wrote:
>> Pardon me for being cynical, but in the entire history of the universe,
>> has anybody ever used input()/raw_input() for anything other than a
>> homework problem?
>>
>
> Not me personally.  I guess raw_input must have been used somewhere at
> some time for something, or it would have been scrapped in Python 3, not
> renamed to input.
>

Actually, to go off at a tangent, I'm just getting into GUIs via 
wxPython.  I've discovered there are distinct advantages having to write 
endless lines of code just to get a piece of data.  For example on a 
Sunday it helps pass the time between the two sessions of the Masters 
Snooker final being shown on TV.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#64304

FromGrant Edwards <invalid@invalid.invalid>
Date2014-01-19 18:15 +0000
Message-ID<lbh4oc$nqv$1@reader1.panix.com>
In reply to#64303
On 2014-01-19, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> On 18/01/2014 18:41, Mark Lawrence wrote:
>> On 18/01/2014 18:30, Roy Smith wrote:
>>> Pardon me for being cynical, but in the entire history of the universe,
>>> has anybody ever used input()/raw_input() for anything other than a
>>> homework problem?
>>
>> Not me personally.  I guess raw_input must have been used somewhere at
>> some time for something, or it would have been scrapped in Python 3, not
>> renamed to input.
>
> Actually, to go off at a tangent, I'm just getting into GUIs via 
> wxPython.  I've discovered there are distinct advantages having to
> write endless lines of code just to get a piece of data.  For example
> on a Sunday it helps pass the time between the two sessions of the
> Masters Snooker final being shown on TV.

Fair enough, but what do you do to pass the time _during_ Snooker
being shown on TV?

I can still remember the point in my first trip to the UK when I
accidentally stumbled across darts on TV. Given the endless variety
(and quantity) of pointless crap that people watch here in the US, I
can't really explain why I was so baffled and amused by darts on TV --
but I was.

-- 
Grant Edwards               grant.b.edwards        Yow! I want EARS!  I want
                                  at               two ROUND BLACK EARS
                              gmail.com            to make me feel warm
                                                   'n secure!!

[toc] | [prev] | [next] | [standalone]


#64306

FromRoy Smith <roy@panix.com>
Date2014-01-19 13:37 -0500
Message-ID<roy-85D529.13372919012014@news.panix.com>
In reply to#64304
In article <lbh4oc$nqv$1@reader1.panix.com>,
 Grant Edwards <invalid@invalid.invalid> wrote:

> I can still remember the point in my first trip to the UK when I
> accidentally stumbled across darts on TV. Given the endless variety
> (and quantity) of pointless crap that people watch here in the US, I
> can't really explain why I was so baffled and amused by darts on TV --
> but I was.

What's so complicated?

points = 501
for dart in throws():
   if points - dart == 0 and dart.is_double():
      raise YouWin
   if points - dart < 0:
      continue
   points -= dart
   beer.drink()

[toc] | [prev] | [next] | [standalone]


#64308

FromChris Angelico <rosuav@gmail.com>
Date2014-01-20 05:43 +1100
Message-ID<mailman.5715.1390156992.18130.python-list@python.org>
In reply to#64306
On Mon, Jan 20, 2014 at 5:37 AM, Roy Smith <roy@panix.com> wrote:
> What's so complicated?
>
> points = 501
> for dart in throws():
>    if points - dart == 0 and dart.is_double():
>       raise YouWin
>    if points - dart < 0:
>       continue
>    points -= dart
>    beer.drink()

assert victory
raise beer

ChrisA

[toc] | [prev] | [next] | [standalone]


#64313

FromGrant Edwards <invalid@invalid.invalid>
Date2014-01-19 19:11 +0000
Message-ID<lbh80h$1jr$1@reader1.panix.com>
In reply to#64306
On 2014-01-19, Roy Smith <roy@panix.com> wrote:
> In article <lbh4oc$nqv$1@reader1.panix.com>,
>  Grant Edwards <invalid@invalid.invalid> wrote:
>
>> I can still remember the point in my first trip to the UK when I
>> accidentally stumbled across darts on TV. Given the endless variety
>> (and quantity) of pointless crap that people watch here in the US, I
>> can't really explain why I was so baffled and amused by darts on TV --
>> but I was.
>
> What's so complicated?
>
> points = 501
> for dart in throws():
>    if points - dart == 0 and dart.is_double():
>       raise YouWin
>    if points - dart < 0:
>       continue
>    points -= dart
>    beer.drink()

That looks like an algorithm for _playing_ darts.  That I understand.
I have two dartboards (one real, one electronic) and a coule decent
sets of darts.  It's watching darts on TV that I don't get.

Actually, I don't really get watching any sort of sports on TV (even
the ones I play).  But there was just something about darts on TV that
seemed particularly beyond the pale.

-- 
Grant Edwards               grant.b.edwards        Yow! But they went to MARS
                                  at               around 1953!!
                              gmail.com            

[toc] | [prev] | [next] | [standalone]


#64323

FromGene Heskett <gheskett@wdtv.com>
Date2014-01-19 15:09 -0500
Message-ID<mailman.5725.1390162736.18130.python-list@python.org>
In reply to#64306
On Sunday 19 January 2014 15:08:31 Roy Smith did opine:

> In article <lbh4oc$nqv$1@reader1.panix.com>,
> 
>  Grant Edwards <invalid@invalid.invalid> wrote:
> > I can still remember the point in my first trip to the UK when I
> > accidentally stumbled across darts on TV. Given the endless variety
> > (and quantity) of pointless crap that people watch here in the US, I
> > can't really explain why I was so baffled and amused by darts on TV --
> > but I was.
> 
> What's so complicated?
> 
> points = 501
> for dart in throws():
>    if points - dart == 0 and dart.is_double():
>       raise YouWin
>    if points - dart < 0:
>       continue
>    points -= dart
>    beer.drink()

Aren't you missing a fi there, or a next dart? ;-)

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>
Required reading: 
<http://culturalslagheap.wordpress.com/2014/01/12/elemental/>
Baseball is a skilled game.  It's America's game - it, and high taxes.
		-- The Best of Will Rogers
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
         law-abiding citizens.

[toc] | [prev] | [next] | [standalone]


#64314

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-01-19 19:17 +0000
Message-ID<mailman.5718.1390159079.18130.python-list@python.org>
In reply to#64304
On 19/01/2014 18:15, Grant Edwards wrote:
> On 2014-01-19, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
>> On 18/01/2014 18:41, Mark Lawrence wrote:
>>> On 18/01/2014 18:30, Roy Smith wrote:
>>>> Pardon me for being cynical, but in the entire history of the universe,
>>>> has anybody ever used input()/raw_input() for anything other than a
>>>> homework problem?
>>>
>>> Not me personally.  I guess raw_input must have been used somewhere at
>>> some time for something, or it would have been scrapped in Python 3, not
>>> renamed to input.
>>
>> Actually, to go off at a tangent, I'm just getting into GUIs via
>> wxPython.  I've discovered there are distinct advantages having to
>> write endless lines of code just to get a piece of data.  For example
>> on a Sunday it helps pass the time between the two sessions of the
>> Masters Snooker final being shown on TV.
>
> Fair enough, but what do you do to pass the time _during_ Snooker
> being shown on TV?
>
> I can still remember the point in my first trip to the UK when I
> accidentally stumbled across darts on TV. Given the endless variety
> (and quantity) of pointless crap that people watch here in the US, I
> can't really explain why I was so baffled and amused by darts on TV --
> but I was.
>

Just no comparison, darts and snooker.  This is excellent though 
http://www.youtube.com/watch?v=sHnBppccI0o

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#64316

FromLarry Martell <larry.martell@gmail.com>
Date2014-01-19 12:24 -0700
Message-ID<mailman.5720.1390159499.18130.python-list@python.org>
In reply to#64304
On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> On 19/01/2014 18:15, Grant Edwards wrote:
>>
>> On 2014-01-19, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
>>> Actually, to go off at a tangent, I'm just getting into GUIs via
>>> wxPython.  I've discovered there are distinct advantages having to
>>> write endless lines of code just to get a piece of data.  For example
>>> on a Sunday it helps pass the time between the two sessions of the
>>> Masters Snooker final being shown on TV.
>>
>>
>> Fair enough, but what do you do to pass the time _during_ Snooker
>> being shown on TV?
>>
>> I can still remember the point in my first trip to the UK when I
>> accidentally stumbled across darts on TV. Given the endless variety
>> (and quantity) of pointless crap that people watch here in the US, I
>> can't really explain why I was so baffled and amused by darts on TV --
>> but I was.
>>
>
> Just no comparison, darts and snooker.  This is excellent though
> http://www.youtube.com/watch?v=sHnBppccI0o

Now that we're way off on the tangent of what some people consider
boring and others don't, I'm really looking forward to watching
curling in the upcoming Olympics.

[toc] | [prev] | [next] | [standalone]


#64317

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-01-19 19:29 +0000
Message-ID<mailman.5721.1390159785.18130.python-list@python.org>
In reply to#64304
On 19/01/2014 19:24, Larry Martell wrote:
> On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
>> On 19/01/2014 18:15, Grant Edwards wrote:
>>>
>>> On 2014-01-19, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
>>>> Actually, to go off at a tangent, I'm just getting into GUIs via
>>>> wxPython.  I've discovered there are distinct advantages having to
>>>> write endless lines of code just to get a piece of data.  For example
>>>> on a Sunday it helps pass the time between the two sessions of the
>>>> Masters Snooker final being shown on TV.
>>>
>>>
>>> Fair enough, but what do you do to pass the time _during_ Snooker
>>> being shown on TV?
>>>
>>> I can still remember the point in my first trip to the UK when I
>>> accidentally stumbled across darts on TV. Given the endless variety
>>> (and quantity) of pointless crap that people watch here in the US, I
>>> can't really explain why I was so baffled and amused by darts on TV --
>>> but I was.
>>>
>>
>> Just no comparison, darts and snooker.  This is excellent though
>> http://www.youtube.com/watch?v=sHnBppccI0o
>
> Now that we're way off on the tangent of what some people consider
> boring and others don't, I'm really looking forward to watching
> curling in the upcoming Olympics.
>

Curling, now there's another good reason to allow Scottish independance :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#64322

FromGene Heskett <gheskett@wdtv.com>
Date2014-01-19 15:12 -0500
Message-ID<mailman.5724.1390162555.18130.python-list@python.org>
In reply to#64244
On Sunday 19 January 2014 15:11:52 Larry Martell did opine:

> On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> 
wrote:
> > On 19/01/2014 18:15, Grant Edwards wrote:
> >> On 2014-01-19, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> >>> Actually, to go off at a tangent, I'm just getting into GUIs via
> >>> wxPython.  I've discovered there are distinct advantages having to
> >>> write endless lines of code just to get a piece of data.  For
> >>> example on a Sunday it helps pass the time between the two sessions
> >>> of the Masters Snooker final being shown on TV.
> >> 
> >> Fair enough, but what do you do to pass the time _during_ Snooker
> >> being shown on TV?
> >> 
> >> I can still remember the point in my first trip to the UK when I
> >> accidentally stumbled across darts on TV. Given the endless variety
> >> (and quantity) of pointless crap that people watch here in the US, I
> >> can't really explain why I was so baffled and amused by darts on TV
> >> -- but I was.
> > 
> > Just no comparison, darts and snooker.  This is excellent though
> > http://www.youtube.com/watch?v=sHnBppccI0o
> 
> Now that we're way off on the tangent of what some people consider
> boring and others don't, I'm really looking forward to watching
> curling in the upcoming Olympics.

I have Larry, and the suspense is not good for those with high blood 
pressure.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>
Required reading: 
<http://culturalslagheap.wordpress.com/2014/01/12/elemental/>
I've enjoyed just about as much of this as I can stand.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
         law-abiding citizens.

[toc] | [prev] | [next] | [standalone]


#64325

FromLarry Martell <larry.martell@gmail.com>
Date2014-01-19 13:22 -0700
Message-ID<mailman.5727.1390162930.18130.python-list@python.org>
In reply to#64244
On Sun, Jan 19, 2014 at 1:12 PM, Gene Heskett <gheskett@wdtv.com> wrote:
> On Sunday 19 January 2014 15:11:52 Larry Martell did opine:
>
>> On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence <breamoreboy@yahoo.co.uk>
> wrote:
>> > On 19/01/2014 18:15, Grant Edwards wrote:
>> >> On 2014-01-19, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
>> >>> Actually, to go off at a tangent, I'm just getting into GUIs via
>> >>> wxPython.  I've discovered there are distinct advantages having to
>> >>> write endless lines of code just to get a piece of data.  For
>> >>> example on a Sunday it helps pass the time between the two sessions
>> >>> of the Masters Snooker final being shown on TV.
>> >>
>> >> Fair enough, but what do you do to pass the time _during_ Snooker
>> >> being shown on TV?
>> >>
>> >> I can still remember the point in my first trip to the UK when I
>> >> accidentally stumbled across darts on TV. Given the endless variety
>> >> (and quantity) of pointless crap that people watch here in the US, I
>> >> can't really explain why I was so baffled and amused by darts on TV
>> >> -- but I was.
>> >
>> > Just no comparison, darts and snooker.  This is excellent though
>> > http://www.youtube.com/watch?v=sHnBppccI0o
>>
>> Now that we're way off on the tangent of what some people consider
>> boring and others don't, I'm really looking forward to watching
>> curling in the upcoming Olympics.
>
> I have Larry, and the suspense is not good for those with high blood
> pressure.

Then don't watch the women:
http://oglympics.com/2010/02/16/women-of-curling-fire-on-ice/

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.python


csiph-web