Glossary — Python 3.6.5 documentation https://docs.python.org/3/glossary.html?highlight=equal

hashable

An object is hashable if it has a hash value which never changes during its lifetime (it needs a __hash__()method), and can be compared to other objects (it needs an __eq__() method). Hashable objects which compare equal must have the same hash value.

Hashability makes an object usable as a dictionary key and a set member, because these data structures use the hash value internally.

All of Python’s immutable built-in objects are hashable; mutable containers (such as lists or dictionaries) are not. Objects which are instances of user-defined classes are hashable by default. They all compare unequal (except with themselves), and their hash value is derived from their id().

不变性对象可以哈希化,可变容器:list、dict不可哈希化

可哈希化的仅仅和自己equal,

immutable 不可变性

An object with a fixed value. Immutable objects include numbers, strings and tuples. Such an object cannot be altered. A new object has to be created if a different value has to be stored. They play an important role in places where a constant hash value is needed, for example as a key in a dictionary.

最新文章

  1. Glassfish在SpringMVC服务端接收请求时字符出现乱码的解决办法
  2. DP(Dynamic programming)——尽力学习之中(2016 HUAS ACM 暑假集训-5)
  3. Hibernate使用
  4. 字节b换算kb/mb/gb/tb/pb
  5. 【BZOJ】1135: [POI2009]Lyz
  6. Python—I/O多路复用
  7. javascript错误处理与调试(转)
  8. java 查询 mongodb 中的objectid
  9. 图片轮播(淡入淡出)--JS原生和jQuery实现
  10. WPF 中,动态创建Button,并使Button得样式按照自定义的Resource样式显示
  11. saiku中多cube排序问题
  12. POJ 3189 Steady Cow Assignment【网络流】
  13. 201521123073 《Java程序设计》第14周学习总结
  14. jmeter利用自身代理录制电脑脚本(一)
  15. 对多字段进行去重 ( Linq 方式 )
  16. 洛谷 P1101 单词方阵
  17. mailkit库收发邮件
  18. Websocket(一)——原理及基本属性和方法
  19. perl5
  20. CentOS7安装mysql后无法启动服务,提示Unit not found

热门文章

  1. Python3.6中文文档 又来推荐一个,之前的Python3.52看得有点懵逼 https://www.rddoc.com/doc/Python/3.6.0/zh/
  2. 剑指Offer(书):机器人的运动范围
  3. Centos 7安装Mysql5.7
  4. C# Updating
  5. luogu1463 [HAOI2007]反素数
  6. 如何取SQL结果集的第一条记录
  7. HDU1412-{A} + {B},通过率并不高,但同样是用一个很简洁的函数unique,超短代码水过~
  8. bzoj2190 [SDOI2008]仪仗队 - 筛法 - 欧拉函数
  9. cp: omitting directory解决方案
  10. 时间戳转换成DateTime