Created
November 27, 2013 14:50
-
-
Save SeavantUUz/7676900 to your computer and use it in GitHub Desktop.
tirck codes
This file contains hidden or 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 fill_object(items,profiles,*args): | |
profiles_dict = {} | |
for profile in profiles: | |
profiles_dict[profile.id] = profile | |
for arg in args: | |
items = map(lambda o:_add_attr(o,profiles_dict,arg),items) | |
return items | |
def _add_attr(item,profiles_dict,arg): | |
profile = profiles_dict.get(item.id) | |
item.__setattr__(arg,getattr(profile,arg)) | |
return item |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment