Re: Running Python Demo on the Web?

2011-09-07 Thread Sahil Tandon
On Wed, 2011-09-07 at 18:40:23 -0700, Laurent wrote: > Neat. But I can see some "print(x)" and some "print x". What is the > Python version? See: http://docs.python.org/release/3.2.2/whatsnew/3.0.html#print-is-a-function http://www.python.org/dev/peps/pep-3105/

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

2011-09-02 Thread Sahil Tandon
Dennis Lee Bieber wrote: On Thu, 1 Sep 2011 00:56:50 -0400, Sahil Tandon # 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 rv

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

2011-09-01 Thread Sahil Tandon
[Thanks to everyone who responded] Steven D'Aprano wrote: On Thu, 1 Sep 2011 02:56 pm Sahil Tandon wrote: %% # unbuffer STDOUT sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) I've never bothered with unbuffered stdout, but that looks fine to me. I'm not sure

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

2011-08-31 Thread Sahil Tandon
is because of some internal buffering when using fileinput. Is there a recommended way to disable such buffering? Am I taking a totally wrong approach? Feel free to just link me to previous discussions on the topic(s) if I have missed them. Please be gentle with your cluebats. :-) Thanks, --