0

PyCLIPS 似乎在翻译非常大的数字之前将它们转换为 int。

请参阅此处进行转换 Python -> CLIPS

def _py2cl(o):
    """convert Python data to a well-formed tuple"""
    t1 = type(o)
    if t1 in (int, long):
        return (_c.INTEGER, int(o))

但也在这里用于转换 CLIPS -> Python

...
def _cl2py(o):
    """convert a well-formed tuple to one of the CLIPS wrappers"""
    if o is None: return None
    elif type(o) == tuple and len(o) == 2:
        if o[0] == _c.INTEGER:
            return Integer(o[1])
...


...
# 1) numeric types
class Integer(int):
    """extend an int for use with CLIPS"""
    def __repr__(self):
        return "<Integer %s>" % int.__repr__(self)
    def __add__(self, o):
        return Integer(int(self) + int(o))
...

在 CLIPS 和 PyCLIPS 中都没有长久的类型,我说得对吗?是否将所有内容都转换(截断)为 int?这是一个错误吗?

我问是因为通过6442901632python 调用将值从 CLIPS 传递给 python 成为 python 中的值0x7fffffff。还是我的 32 位 Python 导致了这个问题?

如何int通过 PyClips 将大于 python 的值从 CLIPS 传递给 python?

4

0 回答 0