Updated Nim for Python Programmers (markdown)
This commit is contained in:
parent
93120209f2
commit
e810404cda
|
@ -128,6 +128,17 @@ So, when using inheritance, be sure to inherit using refs, unless you know what
|
||||||
|
|
||||||
## From Python to Nim
|
## From Python to Nim
|
||||||
|
|
||||||
|
### Python strings
|
||||||
|
|
||||||
|
Use double quotes: "foo" or """foo""", not 'foo'
|
||||||
|
|
||||||
|
Strings are always unicode. Remember to use runes() to iterate over unicode characters instead of bytes.
|
||||||
|
|
||||||
|
``` Nim
|
||||||
|
var a = "hello"
|
||||||
|
echo a[0..1] # returns "he": ranges are inclusive!
|
||||||
|
```
|
||||||
|
|
||||||
### Python tuples
|
### Python tuples
|
||||||
|
|
||||||
Nim Tuples are close to Python nametuples, see [manual](http://nim-lang.org/manual.html#tuples-and-object-types).
|
Nim Tuples are close to Python nametuples, see [manual](http://nim-lang.org/manual.html#tuples-and-object-types).
|
||||||
|
|
Loading…
Reference in New Issue