|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 2OLEGEND 于 2018-1-24 16:20 编辑
- class C:
- def __getattribute__(self, name):
- print('getattribute')
- #使用super()调用object基类的__getattribute__()方法
- return super().__getattribute__(name)
- def __getattr__(self, name):
- print('getattr')
- def __setattr__(self, name, value):
- print('setattr')
- super().__setattr__(name, value)
- def __delattr__(self, name):
- print('delattr')
- super().__delattr__(name)
-
- c = C()
- c.x
复制代码
请问各位老师,代码是照着小甲鱼老师的视频和书敲上去的,为什么会是死循环?
3.6.4版本,spyder。
谢谢各位老师!
这是运行代码之后的显示:
getattribute
getattr
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
但是我将代码,用IDLE打开之后,就可以运行,是正常的,这是为什么呢?
这个spyder和IDLE的区别在哪?之前的一个帖子也是我问的关于计时器的问题,也是在IDLE中可以运行没有问题,在Spyder中就不行,这是啥原因了? |
|