1. <legend id='8ac8b'><style id='8ac8b'><dir id='8ac8b'><q id='8ac8b'></q></dir></style></legend>
    <tfoot id='8ac8b'></tfoot>

    <i id='8ac8b'><tr id='8ac8b'><dt id='8ac8b'><q id='8ac8b'><span id='8ac8b'><b id='8ac8b'><form id='8ac8b'><ins id='8ac8b'></ins><ul id='8ac8b'></ul><sub id='8ac8b'></sub></form><legend id='8ac8b'></legend><bdo id='8ac8b'><pre id='8ac8b'><center id='8ac8b'></center></pre></bdo></b><th id='8ac8b'></th></span></q></dt></tr></i><div id='8ac8b'><tfoot id='8ac8b'></tfoot><dl id='8ac8b'><fieldset id='8ac8b'></fieldset></dl></div>

    <small id='8ac8b'></small><noframes id='8ac8b'>

        <bdo id='8ac8b'></bdo><ul id='8ac8b'></ul>

      Python中元组和冻结集之间的区别

      Difference between tuples and frozensets in Python(Python中元组和冻结集之间的区别)

      <tfoot id='jYBGg'></tfoot>
    1. <i id='jYBGg'><tr id='jYBGg'><dt id='jYBGg'><q id='jYBGg'><span id='jYBGg'><b id='jYBGg'><form id='jYBGg'><ins id='jYBGg'></ins><ul id='jYBGg'></ul><sub id='jYBGg'></sub></form><legend id='jYBGg'></legend><bdo id='jYBGg'><pre id='jYBGg'><center id='jYBGg'></center></pre></bdo></b><th id='jYBGg'></th></span></q></dt></tr></i><div id='jYBGg'><tfoot id='jYBGg'></tfoot><dl id='jYBGg'><fieldset id='jYBGg'></fieldset></dl></div>
        <tbody id='jYBGg'></tbody>

        <bdo id='jYBGg'></bdo><ul id='jYBGg'></ul>
        <legend id='jYBGg'><style id='jYBGg'><dir id='jYBGg'><q id='jYBGg'></q></dir></style></legend>

            <small id='jYBGg'></small><noframes id='jYBGg'>

              1. 本文介绍了Python中元组和冻结集之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 The Quick Python Book 学习 Python 3,作者在其中谈到了frozensets,并指出由于 set 是可变的,因此不可散列,因此不适合作为字典键,因此引入了它们的 freeze 对应项.除了元组是有序数据结构而frozenset(或更一般地说是集合)是无序的明显区别之外,元组和frozenset之间还有其他区别吗?

                I'm learning Python 3 using The Quick Python Book, where the author talks about frozensets, stating that since sets are mutable and hence unhashable, thereby becoming unfit for being dictionary keys, their frozen counterparts were introduced. Other than the obvious difference that a tuple is an ordered data structure while frozenset, or more generally a set, is unordered, are there any other differences between a tuple and a frozenset?

                推荐答案

                tuples 是不可变的listsfrozensets 是不可变的sets.

                tuples are immutable lists, frozensets are immutable sets.

                tuples 确实是对象的有序集合,但它们可以包含重复和不可散列的对象,并且具有切片功能

                tuples are indeed an ordered collection of objects, but they can contain duplicates and unhashable objects, and have slice functionality

                frozensets 没有被索引,但你有 sets 的功能 - O(1) 元素查找,以及联合和交集等功能.它们也不能包含重复项,就像它们的可变对应项一样.

                frozensets aren't indexed, but you have the functionality of sets - O(1) element lookups, and functionality such as unions and intersections. They also can't contain duplicates, like their mutable counterparts.

                这篇关于Python中元组和冻结集之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Pythonic and efficient way of finding adjacent cells in grid(在网格中查找相邻单元格的 Pythonic 和有效方法)
                map a hexagonal grid in matplotlib(在 matplotlib 中映射六边形网格)
                Execute arbitrary python code remotely - can it be done?(远程执行任意 python 代码 - 可以吗?)
                Python - Plotting colored grid based on values(Python - 根据值绘制彩色网格)
                Is there a GUI design app for the Tkinter / grid geometry?(是否有 Tkinter/网格几何图形的 GUI 设计应用程序?)
                tkinter Canvas Scrollbar with Grid?(带有网格的 tkinter 画布滚动条?)

                    <i id='IDk7C'><tr id='IDk7C'><dt id='IDk7C'><q id='IDk7C'><span id='IDk7C'><b id='IDk7C'><form id='IDk7C'><ins id='IDk7C'></ins><ul id='IDk7C'></ul><sub id='IDk7C'></sub></form><legend id='IDk7C'></legend><bdo id='IDk7C'><pre id='IDk7C'><center id='IDk7C'></center></pre></bdo></b><th id='IDk7C'></th></span></q></dt></tr></i><div id='IDk7C'><tfoot id='IDk7C'></tfoot><dl id='IDk7C'><fieldset id='IDk7C'></fieldset></dl></div>

                      <tfoot id='IDk7C'></tfoot>

                      <legend id='IDk7C'><style id='IDk7C'><dir id='IDk7C'><q id='IDk7C'></q></dir></style></legend>
                    • <small id='IDk7C'></small><noframes id='IDk7C'>

                        <tbody id='IDk7C'></tbody>

                        • <bdo id='IDk7C'></bdo><ul id='IDk7C'></ul>