Skip to content

Instantly share code, notes, and snippets.

@yatakeke
Created February 17, 2020 09:37
Show Gist options
  • Save yatakeke/41e1623086b698a8a018938536a185d1 to your computer and use it in GitHub Desktop.
Save yatakeke/41e1623086b698a8a018938536a185d1 to your computer and use it in GitHub Desktop.
from typing import NamedTuple
class PathContainer(NamedTuple):
root: str
document: str
exe: str
path_container = PathContainer("root_path","document_path","exe_path")
# immutableだけど各要素に名前でアクセスできるのが良い点
# defaultで値も設定できる
# reference JP : https://qiita.com/Seny/items/add4d03876f505442136
# reference EN : https://dbader.org/blog/writing-clean-python-with-namedtuples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment