随笔分类 - ThinkPython
How to think like a scientist:
learn with Python
摘要:17. Inheritance 继承 17.1. Inheritance The language feature most often associated with object-oriented programming is inheritance. Inheritance is the ability to define a new class that is a modified ver...
阅读全文
摘要:1. The way of the program 编程的方式(我更喜欢译作编程之路) The goal of this book is to teach you to think like a computer scientist. This way of thinking combines some of the best features of mathematics, engineerin...
阅读全文
摘要:14. Classes and functions 类和函数 14.1. Time 时间 As another example of a user-defined type, we’ll define a class called Time that records the time of day. The class definition looks like this:class Time: ...
阅读全文
摘要:15. Classes and methods 类和方法 15.1. Object-oriented features 面对对象特性 Python is an object-oriented programming language(面向对象编程语言), which means that it provides features that support object-oriented progr...
阅读全文
摘要:13. Classes and objects 类和对象(前面的暂时跳过,第一版的时候已经学过了,感觉变化不大,继续学我那纠结的OOP) 13.1. Object-oriented programming 面向对象编程 Python is an object-oriented programming language, which means that it provides features t...
阅读全文
摘要:Chapter3Functions函数3.1Functioncalls函数调用Youhavealreadyseenoneexampleofafunctioncall:>>>type("32")<type'str'>Thenameofthefunctionistype,anditdisplaysthetypeofavalueorvariable.Thevalueorvariable,whichiscalledtheargumentofthefunction,hastobeenclosedinparentheses.Itiscomm
阅读全文
摘要:最近在看MIT的Python教程,简单易懂,适合刚入门的朋友看。我将这些整理成资料,做了轻微的删减,第一章基本属于开场白介绍,就没整了。2.1Valuesandtypes(值和类型)Avalueisoneofthefundamentalthings—likealetteroranumber—thataprogrammanipulates.Thevalueswehaveseensofarare2(theresultwhenweadded1+1),and"Hello,World!".Thesevaluesbelongtodierenttypes:2isaninteger,and
阅读全文