We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 189965b commit ece9d17Copy full SHA for ece9d17
py/bytes.go
@@ -240,5 +240,27 @@ func (a Bytes) M__ge__(other Object) (Object, error) {
240
return NotImplemented, nil
241
}
242
243
+func (a Bytes) M__add__(other Object) (Object, error) {
244
+ if b, ok := convertToBytes(other); ok {
245
+ o := make([]byte, len(a)+len(b))
246
+ copy(o[:len(a)], a)
247
+ copy(o[len(a):], b)
248
+ return Bytes(o), nil
249
+ }
250
+ return NotImplemented, nil
251
+}
252
+
253
+func (a *Bytes) M__iadd__(other Object) (Object, error) {
254
255
+ *a = append(*a, b...)
256
+ return *a, nil
257
258
259
260
261
// Check interface is satisfied
-var _ richComparison = (Bytes)(nil)
262
+var (
263
+ _ richComparison = (Bytes)(nil)
264
+ _ I__add__ = (Bytes)(nil)
265
+ _ I__iadd__ = (*Bytes)(nil)
266
+)
0 commit comments