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

Diez B. Roggisch deets at nospam.web.de
Mon Jan 8 04:41:07 EST 2007


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



More information about the Python-list mailing list