<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 21, 2016 at 2:41 PM, Sturla Molden <span dir="ltr"><<a href="mailto:sturla.molden@gmail.com" target="_blank">sturla.molden@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Ralf Gommers <<a href="mailto:ralf.gommers@gmail.com">ralf.gommers@gmail.com</a>> wrote:<br>
> Hi all,<br>
><br>
> For a long time we've had both a Python (KDTree) and a Cython/C++ (cKDTree)<br>
> version of a k-d tree structure in scipy.spatial. The cKDTree version<br>
> reached feature-parity with KDTree in 0.12.0, and new features are being<br>
> added regularly now. So keeping the orders of magnitude slower pure Python<br>
> version seems to be a bit pointless - only adds to a maintenance burden and<br>
> to giving users an unnecessary choice to make.<br>
><br>
> So proposal: remove the pure Python code and make KDTree an alias for<br>
> cKDTree. This can be done straight away.<br>
><br>
> For the future it may also be desirable to get rid of the duplicate name.<br>
> The issue then is which one to keep. KDTree is nicer, but it would require<br>
> users who have picked the fast version now to change their code. So maybe<br>
> just deprecate one in documentation, but keep both names working?<br>
<br>
<br>
</span>What about this?<br>
<br>
1. make KDTree an alias for cKDTree<br>
2. make KDTreeNode an alias for cKDTreeNode<br>
3. keep all names working<br>
4. only have KDTree and KDTreeNode in the documentation<br>
5. keep kdtree.py for the test suite, but do not export its contents<br></blockquote><div><br></div><div>That sounds good to me. Keeping the Python version as a fancy test class may be useful.<br><br>The only thing that we should probably provide is a robust version comparator (anyway a good idea), so users can write this in a robust way:<br><br></div><div> if scipy_version >= (0, 18, 0):<br></div><div> KDTree()<br></div><div> else:<br></div><div> cKDTree()<br><br></div><div> Ralf<br><br></div></div></div></div>