上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 72 下一页
摘要: 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)
摘要: class NumString: def __init__(self, value): self.value = str(value) def __str__(self): return self.value ... 阅读全文
posted @ 2017-06-23 20:47 2021年的顺遂平安君 阅读(62) 评论(0) 推荐(0)
摘要: ``` class NumString: def __init__(self, value): self.value = str(value) def __str__(self): return self.value def __int__(self): return int(self.value) def _... 阅读全文
posted @ 2017-06-23 20:47 2021年的顺遂平安君 阅读(537) 评论(0) 推荐(0)
摘要: 把 加到 文件中。 阅读全文
posted @ 2017-06-23 19:29 2021年的顺遂平安君 阅读(213) 评论(0) 推荐(0)
摘要: 把syntax on加到$HOME/.vimrc文件中。 阅读全文
posted @ 2017-06-23 19:29 2021年的顺遂平安君 阅读(51) 评论(0) 推荐(0)
上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 72 下一页