Python Idiom Question

Tim Daneliuk tundra at tundraware.com
Mon Jul 9 21:00:01 EDT 2001


James Logajan wrote:
> 
> Tim Daneliuk wrote:
> >
> > What is the equivalent python idiom to the following 'C' code:
> >
> > while (x=getchar() != 'N')
> >         {
> >         Do something}
> >
> > In other words, is there a convenient way to simultaneously get
> > input, from say, raw_input() or f.read(), and check the return
> > value agains some logical construct, re pattern match, or whatever?
> 
> What is wrong with:
> 
> while 1:
>         x=raw_input()
>         if x == 'N': break
>         Do something

Nothing - I was just doing a quick idiom check to make sure I was in
the ballpark.  Tnx for the reply.
-- 
------------------------------------------------------------------------------
Tim Daneliuk
tundra at tundraware.com



More information about the Python-list mailing list