From fb065f5088a27d10606f3f76da38a277c853d343 Mon Sep 17 00:00:00 2001 From: Federico Ceratto Date: Sat, 11 Apr 2015 16:42:39 +0100 Subject: [PATCH] Updated Nim for Python Programmers (markdown) --- Nim-for-Python-Programmers.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Nim-for-Python-Programmers.md b/Nim-for-Python-Programmers.md index bbab0a8..4828b4b 100644 --- a/Nim-for-Python-Programmers.md +++ b/Nim-for-Python-Programmers.md @@ -106,7 +106,7 @@ var c = Cat(name: "Tom") c.increase_age() echo c.name, " ", c.age ``` - +Tip: use objects by reference ### Inheritance @@ -130,7 +130,14 @@ So, when using inheritance, be sure to inherit using refs, unless you know what ### 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). +Use Nim arrays: +``` Nim +var a = ["hi", "there"] +var b = [1, 2, 3] +echo b[1] +var c = ["hi", 1] # no mixed types please +``` ### Python sets