is parameter an iterable?
robert.kern at gmail.com
Tue Nov 15 20:43:54 CET 2005
> Dan Sommers wrote:
>>Just do it. If one of foo's callers passes in a non-iterable, foo will
>>raise an exception, and you'll catch it during testing
> That's exactly what I don't want. I don't want an exception, instead I
> want to check to see if it's an iterable....if it is continue, if not
> return an error code.
Why return an error code? Just pass along the exception (i.e. do nothing
special). Python's exception mechanism is far superior to error codes.
Don't try to fight the language.
> I can't catch it during testing since this is
> going to be used by other people.
Then *they'll* catch it during testing.
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list