Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
类型错误:';功能';对象在python中不可下标_Python_Python 3.x - Fatal编程技术网

类型错误:';功能';对象在python中不可下标

类型错误:';功能';对象在python中不可下标,python,python-3.x,Python,Python 3.x,我不明白写最后一行有什么问题。 extend1是字典分派中的函数 def make_mutable_rlist(ctor=None): """Return a functional implementation of a mutable recursive list""" contents = empty_rlist if ctor != None: i=ctor['length']()-1 print (i) while

我不明白写最后一行有什么问题。 extend1是字典分派中的函数

def make_mutable_rlist(ctor=None):
    """Return a functional implementation of a mutable recursive list"""
    contents = empty_rlist
    if ctor != None:
        i=ctor['length']()-1
        print (i)
        while i >=0:
            contents = make_rlist(ctor['get_item'](i),contents)
            i-=1
    def length():
        return len_rlist(contents)
    def get_item(index):
        return getitem_rlist(contents,index)
    def push_first(value):
        nonlocal contents
        contents = make_rlist(value,contents)

    def extend1(mutable_list):
        nonlocal contents
        len1 = length()-1
        len2 = mutable_list['length']()
        for i in range (len1,len1+len2):
            contents['push_first'](mutable_list['get_item'](i))

第二行是什么:
非本地内容
?在extended1@RuhulAmin之外的另一个函数中定义的内容,然后在代码中添加该函数,这样我们就可以检查更新@RuhulAmin
内容['push_first'][(可变_列表['get_item'](i))][/code>试试这个