Create a gist now

Instantly share code, notes, and snippets.

jankycollections.py
def jankynamedtuple_init(self, *args):
for prop, arg in zip([i for i in dir(self) if not i.startswith('__')], args):
setattr(self, prop, arg)
def jankynamedtuple(typename, field_names):
tempclass = type(typename, (object,), {k: None for k in field_names.split()})
tempclass.__init__ = jankynamedtuple_init
return tempclass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment