Last active
December 23, 2015 07:39
-
-
Save kissgyorgy/6602353 to your computer and use it in GitHub Desktop.
Python: nested list fun
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
# very beautiful, readable code, isn't it? :D | |
shared_app_models = [app_model for app_models in [get_models(app) for app in map(lambda appstr: get_app(appstr.split('.')[-1]), getattr(settings, 'SHARED_APPS'))] for app_model in app_models] |
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
shared_app_models = [] | |
shared_apps = map(lambda appstr: get_app(appstr.split('.')[-1]), getattr(settings, 'SHARED_APPS')) | |
for app in shared_apps: | |
for model in get_models(app): | |
shared_app_models.append(model) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment