Skip to content
This repository was archived by the owner on Apr 21, 2023. It is now read-only.

Commit 8a70fd4

Browse files
authored
Update Python.swift
1 parent d383a1b commit 8a70fd4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

PythonKit/Python.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@ public struct ThrowingPythonObject {
394394
}
395395
return (elt0, elt1, elt2, elt3)
396396
}
397+
398+
public var count: Int? {
399+
base.checking.count
400+
}
397401
}
398402

399403

@@ -507,6 +511,10 @@ public struct CheckingPythonObject {
507511
}
508512
return (elt0, elt1, elt2, elt3)
509513
}
514+
515+
public var count: Int? {
516+
Int(Python.len(base))
517+
}
510518
}
511519

512520
//===----------------------------------------------------------------------===//
@@ -1402,7 +1410,7 @@ extension PythonObject : Sequence {
14021410

14031411
extension PythonObject {
14041412
public var count: Int {
1405-
Int(Python.len(self))!
1413+
checking.count!
14061414
}
14071415
}
14081416

0 commit comments

Comments
 (0)