Created
August 15, 2018 20:41
-
-
Save mouseroot/3be811163677657852a869b987e8c360 to your computer and use it in GitHub Desktop.
Pythonic examples vs. C like syntax
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
program_source = """ | |
print "Test" | |
print "Hello world" | |
end | |
""" | |
def parse_source(source_data): | |
return list(filter(lambda line: line != "", source_data.splitlines())) | |
def c_parse_source(source_data): | |
result = [] | |
lines = source_data.splitlines() | |
for line in lines: | |
if line != "": | |
result.append(line) | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment