Newbie: conventional instead of recursive way
Steve Holden
sholden at holdenweb.com
Wed Dec 18 17:29:21 EST 2002
"Igor Zivkovic" <izivkov1 at jagor.srce.hr> wrote in message
news:atqrif$fe6$1 at bagan.srce.hr...
> Paul Rubin <phr-n2002b at nospamnightsong.com> wrote:
>
> > def printList(L):
> > for x in L:
> > if type(x) == type([]):
> > printList(x)
> > else:
> > print x
>
> Thanks, but I'm looking for a pure conventional solution so no recursions
> are allowed.
>
You can look as long as you like. What makes you feel that recursion is
"unconventional"? It's a perfectly valid technique for dealing with
recursive data structures, and in fact the most natural way to handle them.
Or is this purely an intellectual exercise? I just don't see what you hope
to gain by avoiding recursion.
regards
-----------------------------------------------------------------------
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/
Bring your musical instrument to PyCon! http://www.python.org/pycon/
-----------------------------------------------------------------------
More information about the Python-list
mailing list