Max point on a line

description

class Solution(object):
    def maxPoints(self, points):
        """
        :type points: List[List[int]]
        :rtype: int
        """

        n = len(points)
        if n == 1:
            return 1
        result = 2
        for i in range(n):
            count = collections.defaultdict(int)
            for j in range(n):
                if j != i: 
                    count[math.atan2(points[j][1] - points[i][1], points[j][0] - points[i][0])] += 1
            result = max(result, max(count.values()) + 1)
        return result