def PointIsOk(coords,num): result = True x = coords[num]["x"] y = coords[num]["y"] del coords[num] length = len(coords) for i in range(0,length): j = i-1 ix = coords[i]["x"] iy = coords[i]["y"] jx = coords[j]["x"] jy = coords[j]["y"] if (((iy(jx-ix)*(y-iy)) | ((iy>jy) & (jy<=y) & (y<=iy) & (jy-iy)*(x-ix)<(jx-ix)*(y-iy)) ): result = not result print coords, result; return result