TypeError:'function'对象在python中不可订阅

时间:2017-01-11 22:58:34

标签: 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 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))

0 个答案:

没有答案