big commit -- adding back object comprehensions, using 'ino', versus 'in' for array comprehensions, fixing bug with dollar signs in identifiers

This commit is contained in:
Jeremy Ashkenas
2010-01-10 15:52:23 -05:00
parent 13fc8aea04
commit 902febb43a
18 changed files with 200 additions and 58 deletions

View File

@@ -4,6 +4,14 @@ results: n * 2 for n in nums
print(results.join(',') is '2,18')
obj: {one: 1, two: 2, three: 3}
names: key + '!' for key, value ino obj
odds: key + '!' for key, value ino obj when value % 2 isnt 0
print(names.join(' ') is "one! two! three!")
print(odds.join(' ') is "one! three!")
evens: for num in [1, 2, 3, 4, 5, 6] when num % 2 is 0
num *= -1
num -= 2