代码拉取完成,页面将自动刷新
// Copyright 2018 The go-python Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Property object
package py
// A python Property object
type Property struct {
Fget func(self Object) (Object, error)
Fset func(self, value Object) error
Fdel func(self Object) error
Doc string
}
var PropertyType = NewType("property", "property object")
// Type of this object
func (o *Property) Type() *Type {
return PropertyType
}
func (p *Property) M__get__(instance, owner Object) (Object, error) {
if p.Fget == nil {
return nil, ExceptionNewf(AttributeError, "can't get attribute")
}
return p.Fget(instance)
}
func (p *Property) M__set__(instance, value Object) (Object, error) {
if p.Fset == nil {
return nil, ExceptionNewf(AttributeError, "can't set attribute")
}
return None, p.Fset(instance, value)
}
func (p *Property) M__delete__(instance Object) (Object, error) {
if p.Fdel == nil {
return nil, ExceptionNewf(AttributeError, "can't delete attribute")
}
return None, p.Fdel(instance)
}
// Interfaces
var _ I__get__ = (*Property)(nil)
var _ I__set__ = (*Property)(nil)
var _ I__delete__ = (*Property)(nil)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。