Skip to content

Commit f409843

Browse files
committed
doc(readme): no longer use newXxx but Xxx for class
1 parent 96f2c73 commit f409843

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,11 @@ class Example(object): # Mimic simple Python "classes".
220220
self.stop = argument
221221
return self.stop
222222
223-
# Oop, the following is no longer Python....
224-
let e = newExample(5, 3)
225-
print(e.stopit(5))
223+
def exa():
224+
e = Example(5, 3)
225+
print(e.stopit(5))
226+
227+
exa()
226228
```
227229

228230
Nimpylib heavily relies on Nim generics, converters, operator overloading, and even on concepts.

examples/readme.nim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ class Example(object): # Mimic simple Python "classes".
164164
self.stop = argument
165165
return self.stop
166166

167-
# Oop, the following is no longer Python....
168-
let e = newExample(5, 3)
169-
print(e.stopit(5))
167+
def exa():
168+
e = Example(5, 3)
169+
print(e.stopit(5))
170+
171+
exa()

src/pylib/pysugar/stmt/class.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ proc replaceSuperCall(n: var NimNode, defSupCls: NimNode, methKind: MethKind): b
7474

7575
result = true
7676

77-
template new*[T; R: RootRef](_: typedesc[R], cls: typedesc[T],
77+
template new*[T; R: ref](_: typedesc[R], cls: typedesc[T],
7878
_: varargs[untyped]): typedesc[T] =
7979
## py's `object.__new__`
8080
cls

0 commit comments

Comments
 (0)