On 12/05/13 03:02, duncan smith wrote:
On 12/05/13 02:29, Dan Stromberg wrote:

On Sat, May 11, 2013 at 4:24 PM, Dan Stromberg <drsali...@gmail.com
<mailto:drsali...@gmail.com>> wrote:

[snip]


What should BinaryTree.find() do if it finds a data.node that is None?


A call to "find(data)" should find and return either a node containing
"data"; or the sentinel node where "data" should be added. It should not
get as far as the left or right child of a sentinel node (which would
equal None). I'll look at this tomorrow. I did have the truth value of a
node depending on it's data value (None implying False). Then I
considered the possibility of actually wanting None as a value in the
tree and changed it, so I could have introduced a bug here.


It's a Python3 thing. The initial sentinel node was evaluating to True. __nonzero__ needs to be changed to __bool__.

Thanks!

PS: Is it about time we moved this discussion off python-list?


Let's do that from now.

Duncan

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to