1
13
不是很像蟒蛇, 全部的 这些检查依赖于新的抽象基类,这些抽象基类在某种程度上正是为了方便这种使用。如果你发现自己在打字 混凝土 知道 你让你的代码变得脆弱,减少了它的使用。
例如,检查是否有
numbers.Integral
字符串是一个困难的情况,但
basestring
可以
有点像工作,如果你真的需要的话。非常肯定
|
2
13
|
3
5
使用时,意图与多种方法一样明显:
|
4
2
来自python核心:
在俾蒙哥:
抱歉,我不知道更多,但我认为有许多方法的例子,根据给定的参数表现不同。这是不强制类型的一部分美。 |
5
1
获得这种功能的一种更为python的方法是,尝试以首选的方式使用它(不管这意味着什么),如果这个论点不支持,那么尝试另一种方法。 有两种方法:
实际上,我要检查的实际属性取决于这些注释中发生了什么,我更喜欢检查我实际使用的属性。 |
July · 如何定义数字间隔,然后四舍五入 1 年前 |
user026 · 如何根据特定窗口的平均值(行数)创建新列? 1 年前 |
Ashok Shrestha · 需要追踪特定的颜色线并获取坐标 1 年前 |
Nicote Ool · 在FastApi和Vue3中获得422 1 年前 |
Abdulaziz · 如何对集合内的列表进行排序[重复] 1 年前 |
asmgx · 为什么合并数据帧不能按照python中的预期方式工作 1 年前 |