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


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

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

Started byDennis Lee Bieber <wlfraed@ix.netcom.com>
First post2011-09-01 22:19 -0700
Last post2011-09-01 22:19 -0700
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2011-09-01 22:19 -0700
SubjectRe: idiomatic analogue of Perl's: while (<>) { ... }
Message-ID<mailman.684.1314940781.27778.python-list@python.org>
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/

[toc] | [standalone]


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


csiph-web