Skip to content

Instantly share code, notes, and snippets.

Created October 30, 2017 03:03
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 anonymous/2f2221c3b89040bceff57073dd552aaa to your computer and use it in GitHub Desktop.
Save anonymous/2f2221c3b89040bceff57073dd552aaa to your computer and use it in GitHub Desktop.
# Store the next available id for all new notes
last_id = 0
class Note:
def __init__(self, memo, tags=''):
'''initialize a note with memo and optional
space-separated tags. Automatically set the note's
creation date and a unique id.'''
self.memo = memo
self.tags = tags
self.creation_date = datetime.date.today()
global last_id
last_id += 1
self.id = last_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment