Skip to content

Instantly share code, notes, and snippets.

@axil
Last active April 16, 2022 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save axil/45997aa82a9ac0400e3e098b9c86278c to your computer and use it in GitHub Desktop.
Save axil/45997aa82a9ac0400e3e098b9c86278c to your computer and use it in GitHub Desktop.
namedtuple
>>> Point = namedtuple('Point', ('x', 'y'))
>>> points = [Point(1,2), Point(2,3), Point(1,2)]
>>> Counter(points)
Counter({Point(x=1, y=2): 2, Point(x=2, y=3): 1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment