本文介绍了Python:定义特定对象类型的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从列表中继承以产生myList类,该类仅接受一种特定类型的对象(例如ints).我相信装饰工可以做到这一点.

I would like to inherit from a list to produce the myList class, that only accepts one specific type of object (say ints).I am sure decorators can do that elegantly.

推荐答案

使用 arrays ?

这篇关于Python:定义特定对象类型的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 05:28