Python 3.15 introduces an immutable or ‘frozen’ dictionary that is useful in places ordinary dicts can’t be used.
Accessing items in a list (and other iterables such as tuples and strings) is a fundamental ability for Python programmers, and many Python tools use similar indexing and slicing principles (e.g., ...
因此 list 有很多内置的方法,比如——insert 等。 另一方面,元组只支持几个内置方法,因为元组是不可变的。 因为不允许修改不可变对象,所以元组没有很多内置函数是有意义的。 您可以运行 dir (list) 和 dir (tuple) 来查看 list 和 tuple 支持的内置函数。
一些您可能无法访问的结果已被隐去。
显示无法访问的结果