摘要: 对象[1:3] 阅读全文
posted @ 2015-08-31 20:21 shinymood 阅读(296) 评论(0) 推荐(0)
摘要: 文档:Customizing attribute accessThe following methods can be defined to customize the meaning of attribute access (use of, assignment to, or deletion o... 阅读全文
posted @ 2015-08-31 14:45 shinymood 阅读(347) 评论(0) 推荐(0)
摘要: __radd__是自定义的类操作符,执行“右加”。当python解释器执行到a+b这样的语句时,首先在查找a中有没有__add__操作符,如果a中没有定义,那么就在b中查找并执行__radd__。至于__iadd__(),是运算符类operator的成员函数,就是累加操作符的另一种调用形式。a = ... 阅读全文
posted @ 2015-08-31 11:26 shinymood 阅读(4556) 评论(0) 推荐(0)