Newbie: conventional instead of recursive way
Laura Creighton
lac at strakt.com
Wed Dec 18 17:40:05 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/
> -----------------------------------------------------------------------
>
Methinks he gets his csc homework done for him without cracking open
his brain, but perhaps I am cynical. In case I have nailed it, though ...
Knock knock! Open up your brain like that! It works better when it can
flap on both sides ...
Laura
>
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list