Re: Loop exception catching

2006-01-25 Thread Ivan Shevanski
On 1/25/06, Ivan Shevanski <[EMAIL PROTECTED]> wrote: On 1/25/06, Fredrik Lundh < [EMAIL PROTECTED]> wrote: Aldo Cortesi wrote:> > What do you mean?>> Well, the problem with "input" is that it allows the user to supply an> arbitrary Python _expression_, which will then be executed. Among other thin

Re: Loop exception catching

2006-01-24 Thread Fredrik Lundh
Aldo Cortesi wrote: > > What do you mean? > > Well, the problem with "input" is that it allows the user to supply an > arbitrary Python expression, which will then be executed. Among other things, > this means that your pet cat could make your script exit due to an uncaught > exception by simply w

Re: Loop exception catching

2006-01-24 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > He'd sure empty your bank account and hard drive, but even he wouldn't > send your porn to your mom, that's just... *mean*!-) He'd send kitty porn, except no one would figure it out ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop exception catching

2006-01-24 Thread Alex Martelli
Paul Rubin wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > I thought I knew some pretty evil cats, but I see my experience with > > felines was nothing compared to yours! > > Catbert? He'd sure empty your bank account and hard drive, but even he wouldn't send yo

Re: Loop exception catching

2006-01-24 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > I thought I knew some pretty evil cats, but I see my experience with > felines was nothing compared to yours! Catbert? -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop exception catching

2006-01-24 Thread Alex Martelli
Aldo Cortesi <[EMAIL PROTECTED]> wrote: ... > this means that your pet cat could make your script exit due to an uncaught > exception by simply walking accross your keyboard. If your cat is sufficiently > clever, it could also empty your bank account, email your entire porn > collection to your

Re: Loop exception catching

2006-01-24 Thread Aldo Cortesi
Thus spake Ivan Shevanski ([EMAIL PROTECTED]): > Thanks, that seems to work fine. But about your other comment. . . > > >Well, leaving aside the merits of using "input" (which should be avoided at > >all costs) > > What do you mean? Well, the problem with "input" is that it allows the user to su

Re: Loop exception catching

2006-01-24 Thread Ivan Shevanski
On 1/23/06, Aldo Cortesi <[EMAIL PROTECTED]> wrote: Well, leaving aside the merits of using "input" (which should be avoided at allcosts), here's one way to do what you want:while 1:try:x = input("> ")break except SyntaxError:print "explain the problem here"Cheers,Al

Re: Loop exception catching

2006-01-23 Thread Aldo Cortesi
Thus spake Ivan Shevanski ([EMAIL PROTECTED]): > Alright this is kind of a continuation of a past conversation. . .But not > really. Anyway, heres the problem. Say I had this: > > try: > x = input("> ") > except SyntaxError: >print "explain the problem he

Re: Loop exception catching

2006-01-23 Thread stv
I'm just learning Python myself, but I just saw an example of something similar. Not sure if this is what you're looking for, but while 1: try: x=input('>') except Exception, e: print 'Problems: ', e else: break The else clause is executed UNLESS something is c

Loop exception catching

2006-01-23 Thread Ivan Shevanski
Alright this is kind of a continuation of a past conversation. . .But not really.  Anyway, heres the problem.  Say I had this:     try:    x = input("> ")    except SyntaxError:   print "explain the problem here"   x = input("> ")That's to catch when people just pres