15.1 User-defined typesWe have used many of Python’s built-in types; now we are going to define a new type. As an example, we will create a type called Point that represents a point in two-dimensional space.In mathematical notation, points are often…
17.1 Object-oriented featuresPython is an object-oriented programming language, which means that it provides features that support object-oriented programming.It is not easy to define object-oriented programming, but we have already seen some of its…
16.1 TimeAs 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(object): """Represents the time of day. attributes: hour, minute, second &qu…
十五. Python基础(15)--内置函数-1 1 ● eval(), exec(), compile() 执行字符串数据类型的python代码 检测#import os 'import' in code ① eval : 有返回值, 适用于执行计算语句, 例如eval("4+3"). ② exec : 没有返回值, 适用于执行流程控制语句, 例如exec(a = b if b>c else c) ③ complie: code1 = 'for i in range(0,3):…
The original link: http://zeroturnaround.com/rebellabs/reloading-objects-classes-classloaders/ A Bird's Eye View 鸟瞰 The first thing to understand when talking about reloading Java code is the relation between classes and objects. All Java code is ass…
Before understanding metaclasses, you need to master classes in Python. And Python has a very peculiar idea of what classes are, borrowed from the Smalltalk language. 在理解元类之前,你先要掌握Python的类.Python中的类是借鉴了小众语言的特殊的类. In most languages, classes are just p…
<Web Scraping with Python> Chapter 1 & 2: Your First Web Scraper & Advanced HTML Parsing BeautifulSoup Key:     P5: urlib or urlib2?  If you’ve used the urllib2 library in Python 2.x, you might have noticed that things have changed somewhat…
原文:零元学Expression Blend 4 - Chapter 15 用实例了解互动控制项「Button」I 本章将教大家如何更改Button的预设Template,以及如何在Button内设置动画. ? 本章将教大家如何更改Button的预设Template,以及如何在Button内设置动画. ? ? ? 01 开启一个新专案,并且置入一个Button,调整到适当大小 ? 在Properties->可以调整Button的外观,基本设定都跟先前的教学雷同 不熟的人请看如何用Blend制作一…
目录 python day 15 1. IO多路复用 2. socketserver源码分析 python day 15 2019/10/20 学习资料来自老男孩教育 1. IO多路复用 ''' I/O多路复用指:通过一种机制,可以监视多个描述符(文件句柄),一旦某个描述符就绪(一般是读就绪或者写就绪),就能够通知程序进行相应的读写操作. 第一个问题: server,监听两个端口, 解决方案: windows通过select(最大1024)来解决. linux使用select,poll,epol…
尚学python课程---15.python进阶语法 一.总结 一句话总结: python使用东西要引入库,比如 json 1.python如何创建类? class ClassName: :以冒号结尾 使用 class 语句来创建一个新类,class 之后为类的名称并以冒号结尾: class ClassName: '类的帮助信息' #类文档字符串 class_suite #类体 类的帮助信息可以通过ClassName.__doc__查看. class_suite 由类成员,方法,数据属性组成.…