Description
Note: This bug seems either mitigated or fixed in #1799, and the writeup here does not reflect those changes.
In b295c13, Tree.cache
was documented in CHANGES.rst
as removed, based on the discovery in #369 that it could not serve its originally intended purpose. But Tree.cache
, and its supporting code such as the TreeModifier
class, were not removed. They remain part of the public interface, are not indicated as deprecated, and nothing in any docstrings counsels against their use.
I am unsure, based on this, if there is any reasonable use of them. My guess is that they may have been retained so that code that calls them without relying on the effect would not be broken, but I am not sure. If that is the case, it could be documented, DeprecationWarning
s could be raised, and some of the non-public code may be possible to remove.
For example, even if TreeModifier.set_done
needs to perform the sort, and do so with exactly the current effect, both the git_cmp
and merge_sort
functions could probably be eliminated entirely, since they were introduced to do something that was cumbersome (at least at the time, supporting Python 2 and 3) with the list.sort
method. But this is no longer the case ever since 4f1110b. If I understand, this change made it no longer sort longer sequences first:
- return len_b - len_a
+ return len_a - len_b