exceptions

John J. Lee jjl at pobox.com
Mon May 31 18:57:50 EDT 2004


Irmen de Jong <irmen at -nospam-remove-this-xs4all.nl> writes:

> Zunbeltz Izaola wrote:
> 
> > Possibly the code should be restructered, and re-designed; there is
> > always room for imporovement. But what I'm doing is not unittest. My
> > program is controling and instrument (an x-ray powder
> > diffractometer) and some parts of the instrument are not working for
> > the moment, so i want to disable all error i get from this instrument
> > (are coded like exceptions)
> 
> What I usually do in comparable situations is to write STUB code for
> the parts of the system that don't work yet.
> Write your stub code so that it does nothing, but doesn't raise any
> exceptions too. The only thing you then have to do is write the rest
> of the code as you would have done, and once the Stubbed parts work,
> replace the stub code with the real code.

...and if you think you want to get exceptions later:

def fixme():
    pass


Sprinkle fixme()s through your code, then redefine later:

def fixme():
    raise NotImplementedError()


John



More information about the Python-list mailing list