part of the way to supporting multiline array comprehensions -- the grammar and parsing is there -- the code generation is tricky

This commit is contained in:
Jeremy Ashkenas
2009-12-27 21:50:02 -08:00
parent ac00a19514
commit aa45456d7d
3 changed files with 13 additions and 5 deletions

View File

@@ -1,4 +1,8 @@
nums: n * n for n in [1, 2, 3] if n % 2 isnt 0.
result: n * 2 for n in nums.
results: n * 2 for n in nums.
print(result.join(',') is '2,18')
# next: for n in [1, 2, 3] if n % 2 isnt 0
# print('hi') if false
# n * n * 2.
print(results.join(',') is '2,18')