Python 继承另一个类的实例
在 javascript 中通过原型链继承,可以实现子类继承父类的方法和属性。
function Bird() {
this.fly = true
}
function Pigeon(){
this.feather = 'white'
}
Pigeon.prototype = new Bird()
alert(new Pigeon().fly)
其实 Python 也可以通过代理模式实现
心态决定姿态,姿态决定状态
在 javascript 中通过原型链继承,可以实现子类继承父类的方法和属性。
function Bird() {
this.fly = true
}
function Pigeon(){
this.feather = 'white'
}
Pigeon.prototype = new Bird()
alert(new Pigeon().fly)
其实 Python 也可以通过代理模式实现
虽然 Linux 以及 Mac OS 都自带的是 Python2,但 Python3 代表现在和未来,并且对 unicode 支持更友好,如果开发一个新项目,还是推荐使用 Python3。