breaking the ; habit

Ken Seehof kens at
Sun Feb 27 19:47:50 EST 2000

from string import find
import sys

old_readline = sys.stdin.readline

def readline():
   s = old_readline()
   while ';' in s:
      n = find(s,';')
      s = s[:n]+s[n+1:]
   return s

sys.stdin.readline = readline

lf11 at wrote:

> In article <38A5E3F0.B3DCEC8E at>, Ivan Van Laningham
>  <ivanlan at> wrote:
> > Hi All--
> >
> > osorronophris osorronophris wrote:
> >>
> >> I'm a die-hard C++ programmer that recently took up Python for a change of
> >> scenery and am enjoying it greatly.  The one problem I am having is that I
> >> can't break myself of the semicolon habit.  I've tried chewing gum but it
> >> just doesn't seem to work, and I'd like to avoid the patch.  Any ideas?
> >>
> I've been playing with Python just two days...and I already have no problem
> with no semicolons.  (Of course, the only other programming language I
> have extensively used is Perl, and that for the past 8 months!)  Unfortunately,
> I tried writing a little Perl script the evening....ooops, I forgot all the damn
> semicolons!
> It took me several months to fully acquire the habit.  It took 45 minutes to break.
> Now, how do I get it _back_ in a timely manner??
>   -lf
> (The only reason I wrote the script in Perl is because "Programming Python" will t
> ake a few days to arrive from  Grrr.  Where's my matter transporter?)

More information about the Python-list mailing list