questions about Exceptions?

skanemupp at yahoo.se skanemupp at yahoo.se
Thu Apr 10 14:40:42 CEST 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...

i never really got what u meant by this?



More information about the Python-list mailing list