1. MRO: method resolution order

lookup order:

L(MyClass) = [MyClass, merged(L(Base1), L(Base2), Base1, Base2)]

2. super(...)

必须所有的父类都call super, 不然会有不可预测的问题

3. class variable & instance variable

查找顺序

 都可以通过 self.x 访问, 所以instance variable 会覆盖class variable, 而class variable 可以用来定义一个default value for instance variable.

如果是mutable的,会有些特殊

4. descriptor

 只能定义在class level, 可以通过在instance里记录每次设置的value来为每个instance 定义不同的value for class variable

Expert Python programming - Reading Notes的更多相关文章

  1. Reading Notes of Acceptance Test Engineering Guide

    The Acceptance Test Engineering Guide will provide guidance for technology stakeholders (developers, ...

  2. 开始 python programming第三版案例分析

    最近研究python,打算将python programming第三版案例分析下 但是全书1600多页 比较费时 而且 介绍太多 感觉没有必要! python programming 堪称经典之作 第 ...

  3. C语言学习书籍推荐《C专家编程Expert C Programming Deep C Secrets》下载

    Peter Van Der Linden (作者) <C和C++经典著作 C专家编程Expert C Programming Deep C Secrets>展示了C程序员所使用的编码技巧, ...

  4. Expert C Programming 阅读笔记(~CH1)

    P4: 好梗!There is one other convention—sometimes we repeat a key point to emphasize it. In addition, w ...

  5. 第一次碰到try-except(core python programming 2nd Edition 3.6)

    # coding: utf-8 # 使用Windows系统,首行'#!/usr/bin/env Pyton'无用,全部改为'# coding: utf-8' 'readtextfile.py -- r ...

  6. The Go Programming Language. Notes.

    Contents Tutorial Hello, World Command-Line Arguments Finding Duplicate Lines A Web Server Loose End ...

  7. Beginning Python Chapter 1 Notes

    James Payne(American)编写的<Beginning Python>中文译作<Python入门经典>,堪称是Python的经典著作. 当然安装Python是很简 ...

  8. [Notes] Reading Notes on [Adaptive Robot Control – mxautomation J. Braumann 2015]

    Reading sources: 1.Johannes Braumann, Sigrid Brell-Cokcan, Adaptive Robot Control (ARC  ) Note: buil ...

  9. TDD in Expert Python Programmin

    Test-Driven Development PrinciplesTDD consists of writing test cases that cover a desired feature, t ...

随机推荐

  1. linux应用之基本命令

    linux操作系统的应用层可以细分为两层:1.系统服务层(包括GUI shell.CUI shell.cron.ftp.远程登录openssh等由init调用的服务)2.系统命令和用户应用. linu ...

  2. JSR 303 - Bean Validation 是什么?

    关于 Bean Validation JSR 303 - Bean Validation 是jree6 中的一项子规范,JSR 303 - Bean Validation着重解决以下实际问题: 在任何 ...

  3. 配置ADT

    配置ADT环境变量打开PATH,添加变量值:F:\android-sdk-windows\tools

  4. 201621123007 Java程序设计第一周 学习总结

    第一周-Java基本概念 201621123007 <Java程序设计> 第一周学习总结 1. 本周学习总结 java是面向对象的一类语言,三大特征:封装性,继承性,多态性. jdk jr ...

  5. CodeForces526F:Pudding Monsters (分治)

    In this problem you will meet the simplified model of game Pudding Monsters. An important process in ...

  6. [SCOI 2014] 方伯伯的玉米田

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=3594 [算法] 首先有一个结论 : 每次选择的区间右端点一定是n 根据这个结论 , ...

  7. caffe参数详解

     转载自:https://blog.csdn.net/qq_14845119/article/details/54929389 solver.prototxt net:训练预测的网络描述文件,trai ...

  8. opencv3.4.0 安装过程中出现的问题

    重新安装opencv3.4.0 参考安装博客: opencv 安装版本测试:pkg-config --modversion opencv https://blog.csdn.net/cocoaqin/ ...

  9. JNI——JAVA调用C

    1. 编译java:javac JNIDemo.java 2. 编译JNI:gcc -I/usr/lib/jvm/java-1.8.0-openjdk-amd64/include/ -I/usr/li ...

  10. TX1 Gsteramer 环境配置

    安装命令: sudo add-apt-repository universe sudo add-apt-repository multiverse sudo apt-get update -tools ...