[Discuss] A question for the Python gurus

Brian Quinlan brian at sweetapp.com
Mon Jul 31 10:06:44 PDT 2006


Adam Parkin wrote:
> Well, actually my original version had one extra set of parenthesis 
> (enclosing the conditional expression),  which I think isn't a bad thing 
> as it helps to more clearly identify what part of the line is the 
> expression and what part is not.

I don't think that it is very hard to identify the expression, since it 
is always:

if <expression>:  OR
while <expression>:

> Interactive (ie - I ran the script, it prompted me for something, I 
> typed some text, hit enter, still nothing on screen, entered some more, 
> hit enter, nothing on screen, hit EOF and got the two lines I entered at 
> once).

You are doing interactive input using raw reads of stdin? Maybe you 
could describe your application. I would probably use the raw_input if 
the application is really supposed to be interactive.

>> "Explode"? The memory required will be triple the length of the line 
>> (plus overhead) i.e. who cares?
> 
> Yikes.  I think triple the memory costs is pretty substantial.

What is the length of your line? 100 characters, 1000? So you are 
incurring ~3K of overhead. Oh no!

Cheers,
Brian


More information about the Discuss mailing list