Re: how to use bool

2008-01-06 Thread bukzor
On Jan 6, 8:56 am, [EMAIL PROTECTED] wrote: > some more doubts in this area,,forgive the ignorance of a beginner > > i have > > class MyError(Exception): >def __init__(self,msg) > self.msg=msg > > now my method that can raise this is > > class SomeClass: > ... >def mymetho

Re: how to use bool

2008-01-06 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > ...if another method in the same class calls this method but wants to > pass the error to a gui code which calls it,,can i do like this > > def callingmethode(self): > try: > mymethod() > except MyError,myerr: > raise myerr > > so that I

Re: how to use bool

2008-01-06 Thread jimgardener
forget about syntax err.. sorry ..but still would like to know if raising exception inside an except clause the right way? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to use bool

2008-01-06 Thread jimgardener
some more doubts in this area,,forgive the ignorance of a beginner i have class MyError(Exception): def __init__(self,msg) self.msg=msg now my method that can raise this is class SomeClass: ... def mymethod(self): if (somecondition): raise MyError("somec

Re: how to use bool

2008-01-06 Thread Paul Hankin
On Jan 3, 3:49 pm, [EMAIL PROTECTED] wrote: > hi, i have some code where i set a bool type variable and if the value > is false i would like to return from the method with an error msg.. > being a beginner I wd like some help here > > class myclass: >      . >     def  mymethod(self): >    

Re: how to use bool

2008-01-06 Thread jimgardener
hi bukzor & everyone who replied thanks for the detailed replies will try to write that way thanx a lot jim bukzor wrote: > On Jan 4, 8:51 am, bukzor <[EMAIL PROTECTED]> wrote: > > #exercise of the class and error handling > m = myclass() > try: > m.mymethod() > print "Completed success

Re: how to use bool

2008-01-04 Thread bukzor
On Jan 4, 8:51 am, bukzor <[EMAIL PROTECTED]> wrote: > On Jan 3, 7:49 am, [EMAIL PROTECTED] wrote: > > > > > hi, i have some code where i set a bool type variable and if the value > > is false i would like to return from the method with an error msg.. > > being a beginner I wd like some help here >

Re: how to use bool

2008-01-04 Thread bukzor
On Jan 3, 7:49 am, [EMAIL PROTECTED] wrote: > hi, i have some code where i set a bool type variable and if the value > is false i would like to return from the method with an error msg.. > being a beginner I wd like some help here > > class myclass: > . > def mymethod(self): >

Re: how to use bool

2008-01-04 Thread Paul McGuire
On Jan 3, 10:09 am, [EMAIL PROTECTED] wrote: > > With my philosophical programming hat on the first thing I'd say (as a > fairly beginning python programmer) is "avoid multiple returns from a > function/method if at all possible".  They breed all sorts of problems > and errors, in particular if the

Re: how to use bool

2008-01-04 Thread tinnews
Chris Mellon <[EMAIL PROTECTED]> wrote: > On 03 Jan 2008 16:09:53 GMT, <[EMAIL PROTECTED]> wrote: > > > > [EMAIL PROTECTED] wrote: > > > hi, i have some code where i set a bool type variable and if the value > > > is false i would like to return from the method with an error msg.. > > > being a be

Re: how to use bool

2008-01-03 Thread Chris Mellon
On 03 Jan 2008 16:09:53 GMT, <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > hi, i have some code where i set a bool type variable and if the value > > is false i would like to return from the method with an error msg.. > > being a beginner I wd like some help here > > > > class myclas

Re: how to use bool

2008-01-03 Thread tinnews
[EMAIL PROTECTED] wrote: > hi, i have some code where i set a bool type variable and if the value > is false i would like to return from the method with an error msg.. > being a beginner I wd like some help here > > class myclass: > . > def mymethod(self): > success=

Re: how to use bool

2008-01-03 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > hi, i have some code where i set a bool type variable and if the value > is false i would like to return from the method with an error msg.. > being a beginner I wd like some help here > > class myclass: > . > def mymethod(self): > success

how to use bool

2008-01-03 Thread jimgardener
hi, i have some code where i set a bool type variable and if the value is false i would like to return from the method with an error msg.. being a beginner I wd like some help here class myclass: . def mymethod(self): success=True msg="all validation OK"