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. Ubuntu下codeblocks编译器程序执行对话框内能进行粘贴编辑操作的指令

    如这个:  gnome-terminal  -t $TITLE -x

  2. Oracle数据查看被锁住的用户

    //lock_date是被锁住时间,如果为空证明这个用户没有被锁住 select username,lock_date from dba_users where username='GFMIS';   ...

  3. codeforces B. Eugeny and Play List 解题报告

    题目链接:http://codeforces.com/problemset/problem/302/B 题目意思:给出两个整数n和m,接下来n行给出n首歌分别的奏唱时间和听的次数,紧跟着给出m个时刻, ...

  4. html5--3.22 综合实例03

    html5--3.22 综合实例03 学习要点 通过一个综合实例来回顾学过的内容 这一章的内容比较多,不必强求一下子全记住,多做一些练习,用得多了自然就可以记住了 可以自己找一些实例练练手,比如各网站 ...

  5. cnn handwrite使用原生的TensorFlow进行预测

    100个汉字,放在data目录下.直接将下述文件和data存在同一个目录下运行即可. 关键参数: run_mode = "train" 训练模型用,修改为validation 表示 ...

  6. druid.io 海量实时OLAP数据仓库 (翻译+总结) (1)——分析框架如hive或者redshift(MPPDB)、ES等

    介绍 我是NDPmedia公司的大数据OLAP的资深高级工程师, 专注于OLAP领域, 现将一个成熟的可靠的高性能的海量实时OLAP数据仓库介绍给大家: druid.io NDPmedia在2014年 ...

  7. .Net-Mongodb学习大全网址

    http://www.yuanjiaocheng.net/csharpmongo/16.html 介绍 在上一篇文章中,我们继续探索MongoDb .NET驱动程序中的数据序列化. 我们查看了各种属性 ...

  8. 【CQ18高一暑假前挑战赛4】标程

    [二分或者STL] 二分: #include<bits/stdc++.h> using namespace std; ; int a[maxn]; int main() { ,pos; s ...

  9. javascript之创建对象的方式

    1.object构造函数创建 var obj=new Object(); obj.name='xue'; 2.对象字面量创建 var obj={ name:'xue' } 3.构造函数创建 funct ...

  10. C++对C的增强

    一.namespace命名空间 1.C++命名空间基本常识所谓namespace,是指标识符的各种可见范围.c++标准程序库中的所有标识符都被定义与一个名为std的namespace中. 1.1:&l ...