python中常见的魔法方法
- 2020-10-16 13:34:00
- 六月
- 来源:
- https://segmentfault.com/a/1190000007256392
- 转贴 738
即用__开头与__结尾的用于实现系统特定功能的变量名与方法名
常用魔法方法
1.__del__方法
2.__call__方法
使用__call__方法实现斐波那契数列
3.__repr__方法
4.__new__方法
5.__str__方法
6.Python中的比较is和==
7.__hash__方法
参考:
https://blog.csdn.net/weixin_44251004/article/details/86503238
发表评论