Curve as attractor

I am new to forum and python scripting for rhino.
below is the script I made for curve as attractor.
wanted to check if there is any other way to do it. I didn’t check because i wanted to develop in my own way.

import rhinoscriptsyntax as rh
import Rhino
import math
#get no. of grip points
xNum = rh.GetInteger(‘horizontal numbers’,6)
yNum = rh.GetInteger(‘vertical numbers’,6)

#select curve to be used as attractor
crv = rh.GetObject(‘select curve’, rh.filter.curve)

#divide curve to get multiple points on curve
pts = rh.DivideCurve(crv,25)
#print pts

#grid size - distance between circles
grdSize= 2

#creating dictionary to put points
point = {}
for i in range(xNum):
for j in range(yNum):
#getting x y coordinate so grid overall has origin as center
x= (i - xNum/2)
y= (j - yNum/2)
#create empty array to save distance of each grid point
#to points on curve to find closest point
dist=
#creating point
point[(i,j)] = (xgrdSize,ygrdSize,0)
for k in range(len(pts)):
#saving dist in list
dist.append(rh.Distance(point[(i,j)],pts[k]))
#zipping distance and point list for sorting to get minimum dist point
srt = zip(dist,pts)
srt.sort()
#print (srt[0])
radius = (srt[0][0])/10
if radius > grdSize/2:
radius = grdSize/2
rh.AddCircle(point[(i,j)],radius)