On Thu, Sep 23, 2010 at 2:32 PM, Alex Hall <mehg...@gmail.com> wrote:

> Hi all,
> A general coding question: is it better to use return(False) (or 0, or
> -1, or whatever) or to raise whateverError("oops")? Are there cases
> for each?


It depends on your prevailing philosophy - if you like the EAFP that
prevails in python, it's better to raise an error. Usually that indicates
that something has failed.

OTOH, a lot of people feel that using exceptions as control flow is bad
practice - they're exceptional so they should only arise in exceptional
case.

There may be performance issues, though I'm not familiar enough with that
yet.

just my two bits,
-Wayne
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to