摘要:
Variables can be private which can be useful on many occasions. A private variable can only be changed within a class method and not outside of the cl 阅读全文
posted @ 2017-06-24 22:00
2021年的顺遂平安君
阅读(385)
评论(0)
推荐(0)
摘要:
Variables can be private which can be useful on many occasions. A private variable can only be changed within a class method ... 阅读全文
posted @ 2017-06-24 22:00
2021年的顺遂平安君
阅读(64)
评论(0)
推荐(0)
摘要:
class Liar(list): def __len__(self): return super().__len__() + 3 # 直接写 super().__len__() 而没有 return 不会返回 length ... 阅读全文
posted @ 2017-06-24 10:45
2021年的顺遂平安君
阅读(61)
评论(0)
推荐(0)
摘要:
```
class Liar(list): def __len__(self): return super().__len__() + 3 # 直接写 super().__len__() 而没有 return 不会返回 length ! a = Liar(['a','b'])
``` 阅读全文
posted @ 2017-06-24 10:45
2021年的顺遂平安君
阅读(1093)
评论(0)
推荐(0)
摘要:
先来看一段代码: 输出结果: 1. 执行的顺序是先 后`__init__ __new__ __init__ __init__`中的 _self_ 。 再来看一段代码: 输出结果: 这里 并没有被调用。这是因为与之前不同,这次 _override_ 了父类的 之后,没有使用 继承父类其他创建 _ins 阅读全文
posted @ 2017-06-24 10:27
2021年的顺遂平安君
阅读(171)
评论(0)
推荐(0)
摘要:
先来看一段代码: class A(object): # -> don't forget the object specified as base def __new__(cls): print ("A. __new__ called... 阅读全文
posted @ 2017-06-24 10:27
2021年的顺遂平安君
阅读(57)
评论(0)
推荐(0)
浙公网安备 33010602011771号