Skip to content

Instantly share code, notes, and snippets.

@yothinix
Created May 17, 2018 06:28
Show Gist options
  • Save yothinix/1033fb041176f3352eda73e765f5d993 to your computer and use it in GitHub Desktop.
Save yothinix/1033fb041176f3352eda73e765f5d993 to your computer and use it in GitHub Desktop.
from verbose_dataclasses import dataclass, field
from datatime import datetime
@dataclass(order=True, unsafe_hash=True)
class Employee:
emp_id: int = field()
name: str = field()
gender: str = field()
salary: int = field(hash=False, repr=False, metadata={'units': 'bitcoin'})
age: int = field(hash=False)
viewed_by: list = field(default_factory=list, compare=False, repr=False)
def access(self, viewer_id):
self.viewed_by.append((viewer_id, datetime.now()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment