Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created May 8, 2024 19:47
Show Gist options
  • Save mypy-play/a4a1450b050e2ab5136751e12357318c to your computer and use it in GitHub Desktop.
Save mypy-play/a4a1450b050e2ab5136751e12357318c to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from typing import NewType
Weight = NewType("Weight", int)
x = Weight(10)
y = Weight(2)
x += y
x = Weight(x + y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment