stylistic question -- optional return value

Andrew Koenig ark at
Thu Aug 29 15:37:26 CEST 2002

Roy> It's also virtually always true that the real way to speed up a
Roy> program is not code tweaking, but using better algorithms.

Like most generalizations, this one is not always true.

Remember, we're talking here about an interface decision, which
means that changing it after the fact is difficult.  Moreover,
this particular program is going to involve a large number of recursive
function calls, every one of which will use this mechanism to pass
information back to its caller.  In this case, therefore, the choice
of interface will have a substantial effect on the execution speed
of the whole program, and it will be difficult to change it later.

In such circumstances, a factor of three is too much to ignore.  I am
not saying that the faster interface is always the right one, but I am
saying that when there's a large speed difference, and the decision
will be difficult to change later, then there had better be a
substantial argument in favor of the slower alternative.  Which
I don't think there is in this case.

Andrew Koenig, ark at,

More information about the Python-list mailing list