Recommendations (or best practices) to define functions (or methods)

vizcayno pretoriano_2001 at
Mon Jan 8 14:29:58 CET 2007

Diez B. Roggisch ha escrito:

> vizcayno schrieb:
> > Hello:
> > Need your help in the "correct" definition of the next function. If
> > necessary, I would like to know about a web site or documentation that
> > tells me about best practices in defining functions, especially for
> > those that consider the error exceptions management.
> > I have the next alternatives but I think there are better:
> <snip/>
> IMHO none of them is good. Python has exceptions. Use them. There is no
> need to awkwardly communicate error conditions using return-values. Use
> return values to return values. Use exceptions in case of errors.
> Diez

Diez, in that case I woul prefer not to use exceptions and wait for
Python to abort itself and wait to see the message it issues.

More information about the Python-list mailing list