# 4*4矩阵旋转90度 def matrix_transposition(data): for index,row in enumerate(data): for col in range(index,len(row)): temp = data[index][col] data[index][col] = data[col][index] data[col][index] = temp return data if __name__ == '__main__': data = [[ col…
一般来说在 Python 中,为了解决内存泄漏问题,采用了对象引用计数,并基于引用计数实现自动垃圾回收.由于Python 有了自动垃圾回收功能,就造成了不少初学者误认为自己从此过上了好日子,不必再受内存泄漏的骚扰了.但如果仔细查看一下Python文档对 __del__() 函数的描述,就知道这种好日子里也是有阴云的.下面摘抄一点文档内容如下: Some common situations that may prevent the reference count of an object from…