Content-Length: 282716 | pFad | https://github.com/go-python/gpython/commit/bb6f44cbf41546da29c1778c5dabbac044282b41

84 py: implement DelItem · go-python/gpython@bb6f44c · GitHub
Skip to content

Commit bb6f44c

Browse files
committed
py: implement DelItem
1 parent 194e817 commit bb6f44c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

py/internal.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ func SetItem(self Object, key Object, value Object) Object {
132132
panic(ExceptionNewf(TypeError, "'%s' object does not support item assignment", self.Type().Name))
133133
}
134134

135+
// Delitem
136+
func DelItem(self Object, key Object) Object {
137+
if I, ok := self.(I__delitem__); ok {
138+
return I.M__delitem__(key)
139+
} else if res, ok := TypeCall1(self, "__delitem__", key); ok {
140+
return res
141+
}
142+
panic(ExceptionNewf(TypeError, "'%s' object does not support item deletion", self.Type().Name))
143+
}
144+
135145
// GetAttrErr - returns the result or an err to be raised if not found
136146
//
137147
// Only AttributeErrors will be returned in err, everything else will be raised

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/go-python/gpython/commit/bb6f44cbf41546da29c1778c5dabbac044282b41

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy