代码拉取完成,页面将自动刷新
// BoundMethod object
//
// Combines an object and a callable
package py
// A python BoundMethod object
type BoundMethod struct {
Self Object
Method Object
}
var BoundMethodType = NewType("boundmethod", "boundmethod object")
// Type of this object
func (o *BoundMethod) Type() *Type {
return BoundMethodType
}
// Define a new boundmethod
func NewBoundMethod(self, method Object) *BoundMethod {
return &BoundMethod{Self: self, Method: method}
}
// Call the bound method
func (bm *BoundMethod) M__call__(args Tuple, kwargs StringDict) (Object, error) {
// Call built in methods slightly differently
// FIXME not sure this is sensible! something is wrong with the call interface
// as we aren't sure whether to call it with a self or not
if m, ok := bm.Method.(*Method); ok {
if kwargs != nil {
return m.CallWithKeywords(bm.Self, args, kwargs)
} else {
return m.Call(bm.Self, args)
}
}
newArgs := make(Tuple, len(args)+1)
newArgs[0] = bm.Self
copy(newArgs[1:], args)
return Call(bm.Method, newArgs, kwargs)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。