Last active
August 29, 2015 14:07
-
-
Save flowerhack/ece098b166da86cb48d1 to your computer and use it in GitHub Desktop.
jankycollections.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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