Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Python

Groovy

Code Block
{}
Code Block
[:] // an empty map
Code Block
Depends:
d if used like:  for k in d:
list(d) if list needed
d.[iter].keys() explicitly
Code Block
d.keySet()
Code Block
d.[iter]values()
Code Block
d.values()
Code Block
[k+1 for k in d]
Code Block
d.collect { k, v -> k+1 }
Code Block
d = dict(zip(k, v))
Code Block
k = 1..3
v = 'a'..'c'
d = [:]; k.eachWithIndex { it, i -> d[it] = v[i] }
println d // [1:"a", 2:"b", 3:"c"]

...