is parameter an iterable?
Grant Edwards
grante at visi.com
Tue Nov 15 15:09:20 EST 2005
On 2005-11-15, py <codecraig at gmail.com> wrote:
> 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. I can't catch it during testing since this is
> going to be used by other people.
If I were those other people, and you decided to return error
codes to me instead of passing up the proper exception (the
good, Pythonic thing to do), I'd be fairly pissed off at you.
An exception is the _right_ way to let the caller know
something is wrong.
--
Grant Edwards grante Yow! I smell like a wet
at reducing clinic on Columbus
visi.com Day!
More information about the Python-list
mailing list