stylistic question -- optional return value

Bengt Richter bokr at
Mon Sep 2 19:37:34 EDT 2002

On Mon, 2 Sep 2002 14:41:57 GMT, Andrew Koenig <ark at> wrote:

>Sebastian> Why not create an additional optional *argument* (say a list, or a
>Sebastian> function), to which you optionally provide your debug information?
>It's not debug information.  I used that term only as an analogy.
>Anyway, I don't want to separate the optional information from the
>rest of it because everything needs to go into the same data structure
What about defining a class to represent the "data structure," and passing
a reference to an instance of that to your various routines, so that they
can populate the structure themselves (via methods/attributes/properties
as convenient) instead of returning data for a caller to do the populating with?

BTW, you mentioned recursion in another part of the thread. Is that as in recursive
descent? An exception is an interesting alternative way to return a first match, with
no need to return anything from unsuccessful visits.

Bengt Richter

More information about the Python-list mailing list