我想问一下Python中的以下内容。它取自http://danieljlewis.org/files/2010/06/Jenks.pdf
我已经输入了评论,告诉我我认为那里正在发生什么。
# Seems to be a function that returns a float vector
# dataList seems to be a vector of flat.
# numClass seems to an int
def getJenksBreaks( dataList, numClass ):
# dataList seems to be a vector of float. "Sort" seems to sort it ascendingly
dataList.sort()
# create a 1-dimensional vector
mat1 = []
# "in range" seems to be something like "for i = 0 to len(dataList)+1)
for i in range(0,len(dataList)+1):
# create a 1-dimensional-vector?
temp = []
for j in range(0,numClass+1):
# append a zero to the vector?
temp.append(0)
# append the vector to a vector??
mat1.append(temp)
(...)
我有点困惑,因为在 pdf 中没有明确的变量声明。但是我认为并希望我能猜到变量。