Skip to content

Instantly share code, notes, and snippets.

@juanarrivillaga
Last active October 26, 2017 04:35
Show Gist options
  • Save juanarrivillaga/2f50fb93851f1818a4f10a56cbb0d187 to your computer and use it in GitHub Desktop.
Save juanarrivillaga/2f50fb93851f1818a4f10a56cbb0d187 to your computer and use it in GitHub Desktop.
Record = namedtuple('Record', 'computer_name ip_address id hist_item')
class KeyedRecord(Record):
__slots__ = ()
def __getitem__(self, item):
try:
return getattr(self,item)
except TypeError:
return super(KeyedMatch, self).__getitem__(item)
# row = Record(key_host, key_ips, index, hist_item)
# row.key_host
# row['key_host']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment