Updated Nim for Python Programmers (markdown)

This commit is contained in:
Federico Ceratto 2015-04-22 13:32:23 +01:00
parent 93120209f2
commit e810404cda
1 changed files with 11 additions and 0 deletions

View File

@ -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).