Python equivalent for C++ STL vector/list containers(C++ STL 向量/列表容器的 Python 等效项)
问题描述
Is there something similar in Python that I would use for a container that's like a vector and a list?
Any links would be helpful too.
You can use the inbuilt list - underlying implementation is similar to C++ vector. Although some things differ - for example, you can put objects of different type in one and the same list.
http://effbot.org/zone/python-list.htm
N.B.: Please keep in mind that vector and list are two very different data structures. List are heterogeneous, i.e. can store different object types, while C++ vectors are homogeneous. The data in vectors is stored in linear arrangement whereas in list is a collection of references to the type and the memory address of the variables.
这篇关于C++ STL 向量/列表容器的 Python 等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C++ STL 向量/列表容器的 Python 等效项


基础教程推荐
- 迭代std :: bitset中真实位的有效方法? 2022-10-18
- 总计将在节日礼物上花多少钱 1970-01-01
- 用指数格式表示浮点数 1970-01-01
- C语言数组 1970-01-01
- C++:为什么结构类需要一个虚拟方法才能成为多态? 2022-10-19
- 向量<unique_ptr<A>>使用初始化列表 2022-10-23
- 明确指定任何或所有枚举数的整数值 1970-01-01
- 对 STL 容器的安全并行只读访问 2022-10-25
- C语言3个整数的数组 1970-01-01
- C++多态 1970-01-01