当将Python列表实现为动态数组时,为什么将它们称为“列表" [英] Why are Python Lists called 'lists' when they are implemented as dynamic arrays

查看:96
本文介绍了当将Python列表实现为动态数组时,为什么将它们称为“列表"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是如何实现Python列表的专家,但据我了解,它们是作为动态数组而不是链接列表实现的.因此,我的问题是,如果将python列表实现为数组,为什么将它们称为列表"而不是数组".

I am no expert in how Python lists are implemented but from what I understand, they are implemented as dynamic arrays rather than linked lists. My question is therefore, if python lists are implemented as arrays, why are they called 'lists' and not 'arrays'.

这仅仅是语义问题,还是背后存在更深层的技术原因? Python中的动态数组实现是否接近列表实现?还是因为动态数组实现使它的行为比数组更接近列表的行为?还是其他我不理解的原因?

Is this just a semantic issue or is there some deeper technical reason behind this. Is the dynamic array implementation in Python close to a list implementation? Or is it because the dynamic array implementation makes its behaviour closer to a list's behaviour than an array? Or some other reason I do not understand?

需要明确的是,我并没有具体询问如何或为什么将Python列表实现为动态数组,尽管这可能与答案有关.

To be clear, I am not asking specifically how or why Python lists are implemented as dynamic arrays, although that might be relevant to the answer.

推荐答案

它们是以列出抽象数据类型,而不是链接列表.这类似于Java的列表的命名界面和C#的 List<T> .

They're named after the list abstract data type, not linked lists. This is similar to the naming of Java's List interface and C#'s List<T>.

这篇关于当将Python列表实现为动态数组时,为什么将它们称为“列表"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆