Skip to content

Instantly share code, notes, and snippets.

@AdamGold
Created March 9, 2019 16:24
Show Gist options
  • Save AdamGold/12572fcbd0c851195603fd84a1c9b1d4 to your computer and use it in GitHub Desktop.
Save AdamGold/12572fcbd0c851195603fd84a1c9b1d4 to your computer and use it in GitHub Desktop.
In [2]: import typing
In [3]: class BetterLookingArticle(typing.NamedTuple):
...: title: str
...: id: int
...: description: str = "No description given."
...:
In [4]: BetterLookingArticle(title="Python is cool.", id=1)
BetterLookingArticle(title='Python is cool.', id=1, description='No description given.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment