4.0.0
版本发布时间: 2018-05-12 04:34:16
joowani/binarytree最新发布版本:6.5.1(2022-03-25 00:59:02)
-
Binarytree version 3.0.0 silently placed a restriction allowing only integers as node values. This was to avoid edge cases that couldn't be handled gracefully (e.g. user-supplied values without random generation or comparison). Pretty printing the tree was also an issue when the
__repr__
of these custom values were too lengthy (tree rendering would break). There were many other technical issues with accepting custom values (which, by the way, is whybinarytree.setup
function was removed). Hopefully in the future, all these challenges are solved sobinarytree.setup
method can be added back again. In the meantime, integers were thought to be enough for the purpose of practicing tree algorithms. But the restriction seemed unnecessarily strong, which is why in this version, support for all number types (e.g. int, float, decimal.Decimal) have been added back. -
Refactored exception names and messages for consistency and clarity.
-
Node.__iter__
now yields node instances instead of node values (see here for details). -
Added new method
Node.values
, which returns the list representation of the binary tree (i.e. node values in level order). This is essentially the replacement for the oldNode.__iter__
(see here for details).