questions about Exceptions?

skanemupp at yahoo.se skanemupp at yahoo.se
Thu Apr 10 06:54:59 EDT 2008


On 10 Apr, 12:38, cokofree... at gmail.com wrote:
> > def Calc():
> >     global nbr
> >     try:
> >         print eval(nbr)
> >         #a = Label(mygui, text=eval(nbr))
> >         #a.place(relx=0.4, rely=0.1, anchor=CENTER)
> >     except:
> >         print "Not computable"
> >     nbr = ""
>
> > def Erase():
> >     global nbr
> >     nbr = ""
>
> Seems to me you could be better off passing a parameter and a return
> statement of None (or your parameter cleaned) for those functions,
> which should work. Given an input, Eval it and then return None. That
> way you wouldn't need the Erase...

the erase() id alwys need if u wanna abort whilst u wrote something.



More information about the Python-list mailing list