Skip to content

Instantly share code, notes, and snippets.

@flowerhack
Last active August 29, 2015 14:07
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 flowerhack/ece098b166da86cb48d1 to your computer and use it in GitHub Desktop.
Save flowerhack/ece098b166da86cb48d1 to your computer and use it in GitHub Desktop.
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