python - Python : Why is: not None = True
问题描述
The title honestly says it all:
Why does not None
return True
. I have seen that bool(None)
apparently returns False
. Is there a good explanation as to why these two events occur this way ?
Edit: I guess what I'm really asking is what led to python implementing None as being a falsy type ?
解决方案
因为否定任何虚假值将导致True
.
推荐阅读
- css - 禁用 align=center on @media
- c - C 在编译时检查数组内容
- javascript - Openlayers 2 + HERE 切片缓存
- powershell - 将excel转成CSV并保存
- python - 如何在字段名称不同的arcpy中将数据从一个表复制到另一个表?
- ios - StackView 的水平分布不起作用
- vuejs2 - Vuex:对象数组元素的表单绑定?
- c# - 在 Xaml C# 中生成问题和按钮的树形图
- javascript - 使用循环或在新构造函数内部进行 DOM 操作?
- java - array.remove() 给出 IndexOutOfBoundsException