Newbie: conventional instead of recursive way

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Wed Dec 18 17:30:51 EST 2002


Igor Zivkovic <izivkov1 at jagor.srce.hr> writes:
> > 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.

Oh I see.  You have to simulate the recursion using a stack then.  For
more information, take a computer science class ;-).  Anyway, there's
nothing unconventional about recursion these days.  Recursion is the
right way to do it.




More information about the Python-list mailing list