Skip to content

Instantly share code, notes, and snippets.

@mouseroot
Created August 15, 2018 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mouseroot/3be811163677657852a869b987e8c360 to your computer and use it in GitHub Desktop.
Save mouseroot/3be811163677657852a869b987e8c360 to your computer and use it in GitHub Desktop.
Pythonic examples vs. C like syntax
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