Re: Validation of parameters

2008-08-10 Thread Terry Reedy
Kless wrote: On 10 ago, 15:03, Paddy <[EMAIL PROTECTED]> wrote: If you just want the absense of _foo to raise an exception then why to just reference self._foo and leave the hard work to ptyhon? Something like: self._foo If it is present then fine, if it is not then an exception is raised.

Re: Validation of parameters

2008-08-10 Thread Kless
On 10 ago, 15:03, Paddy <[EMAIL PROTECTED]> wrote: > If you just want the absense of _foo to raise an exception then why to > just reference self._foo and leave the hard work to ptyhon? Something > like: > >   self._foo > > If it is present then fine, if it is not then an exception is raised. It on

Re: Validation of parameters

2008-08-10 Thread Paddy
On Aug 10, 9:13 am, Kless <[EMAIL PROTECTED]> wrote: > Which is the best mode for validation of parameters? I'm using the > next way but it is not well testable. > > - > if not self._foo: >     try: >         raise ValueError('Val

Validation of parameters

2008-08-10 Thread Kless
Which is the best mode for validation of parameters? I'm using the next way but it is not well testable. - if not self._foo: try: raise ValueError('ValueError: foo not found') except ValueError, err: print (err.message)