Bounds checking
Martin De Kauwe
mdekauwe at gmail.com
Fri Mar 18 18:39:29 EDT 2011
> Offhand, my only quibble is that sys.exit is not helpful for debugging.
> Much better to raise an error:
>
> if not self.funcTable.get(attribute, lambda x: True)(value):
> raise ValueError ('error out of bound')
>
> or define a subclass of ValueError just for this purpose. On error, the
> program will stop just as dead, but you'll get a trace.
>
> Mel.
I think generally I prefer my code to die and as long as I know where
(from the statement) the error occurred I know generally what point I
have to debug up until. Can you explain how your solution would be
easier with a trace as I don't tend to use the raise/assert
functionality so I am interested.
thanks
More information about the Python-list
mailing list