How robust is Python ?

Sandipan Gangopadhyay sandipan at vsnl.com
Sat Jan 13 05:37:42 EST 2001


Thanks for the suggestions.

Regards,

Sandipan

----- Original Message -----
From: "Thomas Wouters" <thomas at xs4all.net>
To: "Moshe Zadka" <moshez at zadka.site.co.il>
Cc: "Sandipan Gangopadhyay" <sandipan at vsnl.com>; <python-list at python.org>
Sent: Saturday, January 13, 2001 7:02 AM
Subject: Re: How robust is Python ?


> On Sat, Jan 13, 2001 at 11:36:45AM +0200, Moshe Zadka wrote:
> > On Fri, 12 Jan 2001, "Sandipan Gangopadhyay" <sandipan at vsnl.com> wrote:
>
> > > If I try a catch-all except, continue hits except on the outer level
rather
> > > than while. Probably the reason that it results in syntax error.
> > >
> > > while binAliveMarker:
> > >   try:
> > >     if binWannaStartAgainLater:
> > >       time.sleep(1)
> > >       continue
> > >     work code ...
> > >   except:
> > >     pass
> > >
> > > Any suggestions to make it work with continue (or an alternative) ?
Apart
> > > from removing continue completely by making the work code inside an
else ?
>
> > I'm afraid that's your only alternative, unless you can afford to wait
> > for Python 2.1 or switch to JPython, both of which support continue
> > inside a try clause.
>
> Moshe is forgetting:
>
> ContinueMePleaseError = "please continue" # or a class if you prefer that
> while binAliveMarker:
>   try:
>     if binWannaStartAgainLater:
>       time.sleep(1)
>       raise ContinueMePleaseError
>     work code ...
>   except ContinueMePleaseError:
>     continue
>   except:
>     pass
>
> which is the usual way of working around it (other than reworking your
code,
> that is.)
>
> --
> Thomas Wouters <thomas at xs4all.net>
>
> Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
>





More information about the Python-list mailing list