builtins.TypeError: catching classes that do not inherit from BaseException is not allowed

Avi Gross avigross at verizon.net
Sat Jan 1 00:18:16 EST 2022


I am sure some people have a sense of humor, but anyone on this forum who
actually does not have some idea of what various "tree" data structures are
in computer science, probably won't get any replies from me when asking such
questions.

But indeed there are things closer to classical trees that are traversed in
various ways including depth-first versus breadth first. Some have special
names like a parse tree or a decision tree and they can even be collected
into a random forest.

But fundamentally, the idea of using a recursion that at each node may take
multiple next steps by calling an instance of itself at the new node, is
fairly common, as are using it to search many kinds of data structures.

The discussion though suggests that no single idea about computer languages
need be used constantly and sometimes recursion is not the only method or
even the best method. You can design tree structures in ways that allow them
to be traversed in an iterative way such as having bi-directional links
along with flags that mark where you entered a node from or already visited.
Tools should be tools, not religions. 

-----Original Message-----
From: Python-list <python-list-bounces+avigross=verizon.net at python.org> On
Behalf Of Karsten Hilbert
Sent: Friday, December 31, 2021 7:09 AM
To: python-list at python.org
Subject: Re: builtins.TypeError: catching classes that do not inherit from
BaseException is not allowed

Am Thu, Dec 30, 2021 at 03:57:25PM -0800 schrieb hongy... at gmail.com:

> > > Then what cases/scenarios can demonstrate the beauty of recursion?
> > >
> > Walking a tree.
>
> There are many type of trees. Do you mean all of them?

Palm trees don't lend themselves to recursion all that much.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list