So, I’ve got a quickhull implementation in python that I’m trying to use in python 3.2. Mostly it’s fine, but there’s a list indexing problem I’m having. The code does:
axis = sample[:,0]
This doesn’t work, as python complains that list indices need to be integers, no tuples. I’m having trouble trying to understand what the line is trying to do. Anyone have any ideas?
Here’s some surrounding code, if that helps:
if len(sample) > 2:
axis = sample[:,0]
base = numpy.take(sample, [numpy.argmin(axis), numpy.argmax(axis)], axis=0)
return link(dome(sample, base),
dome(sample, base[::-1]))
else:
return sample
(Additionally, I’m not sure what the base[::-1] means, but that at least works.)
axisis a Python list, but it should be a numpy array. The code is using numpy’s special indexing rules for arrays to extract the first column.