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


Groups > comp.lang.python > #12614

Re: idiomatic analogue of Perl's: while (<>) { ... }

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: idiomatic analogue of Perl's: while (<>) { ... }
Date 2011-09-01 22:19 -0700
Organization > Bestiaria Support Staff <
References <20110901045650.GA3466@magic.hamla.org>
Newsgroups comp.lang.python
Message-ID <mailman.684.1314940781.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, 1 Sep 2011 00:56:50 -0400, Sahil Tandon <sahil@FreeBSD.org>
declaimed the following in gmane.comp.python.general:

> I've been tasked with converting some programs from Perl -> Python, and
> am (as will soon be obvious) new to the language.  A few archive/google
> searches were inconclusive on a consensus approach, which is OK, but I
> just wonder if there is a more Python-esque way to do the following in
> Python 2.7.1:
> 
> %%
> # unbuffer STDOUT
> sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
> 
> # process input, line-by-line, and print responses after parsing input 
> while 1:
>   rval = parse(raw_input())
>   if rval == None:

	There is only ONE "None" object so the preferred method is

	if rval is None:


	Note: I don't see any exit handler/condition...
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: idiomatic analogue of Perl's: while (<>) { ... } Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-09-01 22:19 -0700

csiph-web