[Tutor] Recursion doubt

Kent Johnson kent37 at tds.net
Wed Apr 23 14:10:00 CEST 2008


Anshu Raval wrote:
> But my question would again be how do you know to put square brackets 
> around path in
> if start == end:
>             return [path]
> in find_all_paths. I am still puzzled by this.

find_all_paths() returns a *list* of paths, even when the result is a 
single path. Without the brackets, it would sometimes return a list and 
sometimes a single path.

Kent


More information about the Tutor mailing list