Ai
3 Star 0 Fork 0

mirrors_go-python/gpython

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
object.go 876 Bytes
一键复制 编辑 原始数据 按行查看 历史
Nick Craig-Wood 提交于 2018-08-22 03:56 +08:00 . Add copyright headers to all files
// 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.
// Functions to operate on any object
package py
import (
"fmt"
)
// Gets the attribute attr from object or returns nil
func ObjectGetAttr(o Object, attr string) Object {
// FIXME
return nil
}
// Gets the repr for an object
func ObjectRepr(o Object) Object {
// FIXME
return String(fmt.Sprintf("<%s %v>", o.Type().Name, o))
}
// Return whether the object is True or not
func ObjectIsTrue(o Object) bool {
if o == True {
return true
}
if o == False {
return false
}
if o == None {
return false
}
if I, ok := o.(I__bool__); ok {
cmp, err := I.M__bool__()
if err == nil && cmp == True {
return true
} else if err == nil && cmp == False {
return false
}
}
return false
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_go-python/gpython.git
git@gitee.com:mirrors_go-python/gpython.git
mirrors_go-python
gpython
gpython
v0.0.2

搜索帮助