Coding choices
Aahz Maruch
aahz at panix.com
Sun Mar 25 12:36:28 EST 2001
In article <2basbt4oe4tkf6hasrlmtmnr5jvbtoq2mm at 4ax.com>,
Daniel Klein <danielk at aracnet.com> wrote:
>
>I've seen Python coded in both of these manners. Is there some
>advantage of one over the other? Or is it just preference?
>
>if condition:
> return something
>raise SomeException
>
>if condition:
> return something
>else:
> raise SomeException
The latter is a tiny bit clearer, the former is a tiny bit more
efficient. Mostly a wash, with personal preference playing the key
factor.
--
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het Pythonista http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
"I won't accept a model of the universe in which free will, omniscient
gods, and atheism are simultaneously true." -- M
More information about the Python-list
mailing list