Move to existing dict section
This commit is contained in:
parent
69ae630ee9
commit
49c688f308
|
@ -182,17 +182,6 @@ echo lc[ y | ( y <- x, y > 5 ), int ]
|
|||
echo lc[ y*2 | ( y <- x ), int ]
|
||||
```
|
||||
|
||||
### Python dictionaries
|
||||
|
||||
``` Nim
|
||||
import tables
|
||||
|
||||
var a = {"hallo": "World", "Key2": "Value2"}.newTable
|
||||
|
||||
for key, value in a:
|
||||
echo key, " " ,value
|
||||
```
|
||||
|
||||
### Python sets
|
||||
|
||||
Python sets are not like [Nim set type](http://nim-lang.org/docs/manual.html#types-set-type).
|
||||
|
@ -206,9 +195,14 @@ Use [Tables](http://nim-lang.org/docs/tables.html) for Python dicts,
|
|||
OrderedTable for Python ordered dicts, and CountTable for Python's Counter.
|
||||
|
||||
``` Nim
|
||||
import tables
|
||||
|
||||
var a = {"hi": 1, "there": 2}.toTable
|
||||
echo a["hi"], " ", a.len
|
||||
assert a.hasKey("hi")
|
||||
|
||||
for key, value in a:
|
||||
echo key, " " ,value
|
||||
```
|
||||
|
||||
### ABC
|
||||
|
|
Loading…
Reference in New Issue