Skip to content

Commit eeaa6ed

Browse files
committed
Add ellipsis
1 parent 1455b43 commit eeaa6ed

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

py/ellipsis.go

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Ellipsis objects
2+
3+
package py
4+
5+
type EllipsisType struct{}
6+
7+
var (
8+
EllipsisTypeType = NewType("EllipsisType", "")
9+
Ellipsis = EllipsisType(struct{}{})
10+
)
11+
12+
// Type of this object
13+
func (s EllipsisType) Type() *Type {
14+
return EllipsisTypeType
15+
}
16+
17+
func (a EllipsisType) M__bool__() Object {
18+
return False
19+
}
20+
21+
func (a EllipsisType) M__str__() Object {
22+
return String("Ellipsis")
23+
}
24+
25+
// Check interface is satisfied
26+
var _ I__bool__ = Ellipsis
27+
var _ I__str__ = Ellipsis

py/py.go

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ type IGetDict interface {
1313

1414
// Some well known objects
1515
var (
16-
Ellipsis Object
1716
// See vm/eval.go - set to avoid circular import
1817
Run func(globals, locals StringDict, code *Code, closure Tuple) (res Object, err error)
1918
RunFrame func(frame *Frame) (res Object, err error)

0 commit comments

Comments
 (0)