Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12614 > unrolled thread
| Started by | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| First post | 2011-09-01 22:19 -0700 |
| Last post | 2011-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.
Re: idiomatic analogue of Perl's: while (<>) { ... } Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-09-01 22:19 -0700
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2011-09-01 22:19 -0700 |
| Subject | Re: 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/
Back to top | Article view | comp.lang.python
csiph-web