Last active
August 30, 2018 17:15
-
-
Save vitalibertas/b16ed8a13d7d2d0516ef2d1b57b60402 to your computer and use it in GitHub Desktop.
Readability: Python List Comprehension vs. Not
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
# List Comprehension: | |
process_dict = dict([(attributes.filename, attributes.st_size) for attributes in file_list if attributes.filename.startswith('solcon')]) | |
# Whitespace Generous: | |
for attributes in file_list: | |
if attributes.filename.startswith('solcon'): | |
process_dict[attributes.filename] = attributes.st_size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment