python3-cookbook
http://python3-cookbook.readthedocs.io/zh_CN/latest/index.html
一般的类找方法,通过MRO找到第一个就停了对吧,可以描述器好像会顺着MRO把所有的方法都执行一遍
原理????
rabbitmq
http://www.rabbitmq.com/tutorials/tutorial-one-go.html
python的xlutils 组件是不是不能处理xlsx格式 的excel?
有人用过python hdfs库或者pyhdfs库么,或者对hadoop熟悉
python 多继承详解
http://www.python.com/html/2013/pythonhexinbiancheng_0828/550.html
python装饰器 == 代码装B神器
class Descriptor:
def init(self, name):
self.name = name
def __get__(self, instance, cls):
    print('getting...')
    if instance is None:
        return self
    else:
        return instance.__dict__[self.name]
def __set__(self, instance, value):
    print("this is Descriptor.__set__")
    instance.__dict__[self.name] = value
def __delete__(self, instance):
    raise AttributeError("Can't delete")
class Typed(Descriptor):
ty = object
def set(self, instance, value):
print("this is Typed.set")
if not isinstance(value, self.ty):
raise TypeError('Expected {}'.format(self.ty))
super().set(instance, value)
class String(Typed):
ty = str
class PosFloat(Float, Positive):
pass
class Sized(Descriptor):
def init(self, args, maxlen, **kwargs):
print("this is in Sized.init")
self.maxlen = maxlen
super().init(args, **kwargs)
def __set__(self, instance, value):
    if len(value) > self.maxlen:
        raise ValueError('Too big')
    super().__set__(instance, value)
class SizedString(String, Sized):
pass
import re
class Regex(Descriptor):
def init(self, args, pat, **kwargs):
print("this is in Regex.init")
self.pat = re.compile(pat)
super().init(args, **kwargs)
def __set__(self, instance, value):
    if not self.pat.match(value):
        raise ValueError('Invalid string')
    super().__set__(instance, value)
class SizedRegexString(String, Sized, Regex):
pass
class Stock(Structure):
_fields = ['name', 'shares', 'price']
name = SizedRegexString('name', maxlen=8, pat='[A-Z]+$')
shares = PosInteger('share')
price = PosFloat('price')
s = Stock('XX', 50, 91.1)
__init__是可以通过__super__来实现,__set__和__get__是不是自带__super__功能啊
python3-cookbook的更多相关文章
- Python 学习教程
		<Core Python Programming>勘误参考表 http://starship.python.net/crew/wesc/cpp/errata2.htm 笨办法学 Pytho ... 
- 如何系统地自学 Python?
		最近开始系统的学习Python,以及整理的一些资料.github记录着个人自学 Python 的过程,持续更新.欢迎大家一起来完善这个自学Python学习的项目,给后来者一个参考的学习过程.githu ... 
- python学习路线--从入门到入土
		入门技术博客 进阶自己挑选 入门基础 Python入门相对容易又可以干很多事(网站,运维,数据,爬虫等),是一门方便的工具语言.2016年TIOBE排名显示Python已经名列第四,成为脚本语言之首. ... 
- 自学 Python
		如何系统地自学 Python? 最近开始系统的学习Python,以及整理的一些资料.github记录着个人自学 Python 的过程,持续更新.欢迎大家一起来完善这个自学Python学习的项目,给 ... 
- 最全数据分析资料汇总(含python、爬虫、数据库、大数据、tableau、统计学等)
		一.Python基础 Python简明教程(Python3) Python3.7.4官方中文文档 Python标准库中文版 廖雪峰 Python 3 中文教程 Python 3.3 官方教程中文版 P ... 
- 计算机电子书 2016 BiliDrive 备份
		下载方式 根据你的操作系统下载不同的 BiliDrive 二进制. 执行: bilidrive download <link> 链接 文档 链接 Go入门指南.epub (1.87 MB) ... 
- 我与python3擦肩而过(二)—— csv文件头哪去啦?
		在看Python Data Visualization Cookbook 这本书(基于python2),开始时读取csv文件头的时候出现问题.查了资料,又是python3的问题,从这个链接找到答案. ... 
- 学python3的书
		<Python Cookbook>3rd Edition http://python3-cookbook.readthedocs.io/zh_CN/latest/copyright.htm ... 
- python2和python3的区别——持续更新
		1.在 cookbook 上看到的,python3支持 *运算符 来接收迭代变量,如: a, *b = [, , , ] python2是不支持的! 2.在 cookbook 上看到的,python3 ... 
- Python3 系列之 并行编程
		进程和线程 进程是程序运行的实例.一个进程里面可以包含多个线程,因此同一进程下的多个线程之间可以共享线程内的所有资源,它是操作系统动态运行的基本单元:每一个线程是进程下的一个实例,可以动态调度和独立运 ... 
随机推荐
- ZOJ-3946 Highway Project (最短路)
			题目大意:一张带权无向图,权有两个参数(d,c),分别表示走过这条边的时间和建造这条边的代价.要求选出一些边,使得0节点到其他点的距离之和最短,并在最短的基础上求最小代价. 题目分析:这是16年浙江省 ... 
- hdu3416 最短路+最大流
			题意:有 n 点 m 边,有出发点 A 到达点 B ,只允许走原图中的最短路,但每条边只允许被走一次,问最多能找出多少条边不重复的最短路 一开始做到的时候瞎做了一发最短路,WA了之后也知道显然不对,就 ... 
- easyui datagrid 表格组件列属性formatter和styler使用方法
			明确单元格DOM结构 要想弄清楚formatter和styler属性是怎么工作的,首先要弄清楚datagrid组件内容单元格的DOM接口,注意,这里指的是内容单元格,不包括标题单元格,标题单元格的结构 ... 
- 用视频编辑软件打不开jpg格式的图片的解决方法
			有时候我们把PSD.JPG等图片导入到素材库中会发现EDIUS视频编辑软件根本就不支持,显示黑屏状态.可是当我们把图片导入EDIUS NX支持下的premierepro里却能够正常显示.这是什么原因呢 ... 
- maxscript,#号和$号
			一,#号: 1,数组 #(123, "hi") 2,系统目录 fileName = getDir #scripts + "\\xxx.ms" 二,$号 节点路径 ... 
- SqlServer中日期和时间数据类型及函数 【转】
			来源:http://blog.csdn.net/royalwzy/article/details/6446075 日期和时间数据类型 下表列出了 Transact-SQL 的日期和时间数据类型. 数据 ... 
- HtmlEncode、HtmlDecode、UrlEncode、UrlDecode
			HtmlEncode: 将 Html 源文件中不允许出现的字符进行编码.例如:"<".">"."&" 等. HtmlDe ... 
- 将n阶方阵左下半三角中的元素值置0.
			/*===================================== 将n阶方阵左下半三角中的元素值置0. 0<n<10. =========================== ... 
- Storyboard里面的几种Segue区别及视图的切换:push,modal,popover,replace和custom
			一.视图切换类型介绍 在storyboard中,segue有几种不同的类型,在iphone和ipad的开发中,segue的类型是不同的. 在iphone中,segue有:push,modal,和cus ... 
- Box Anemometer
			https://sourceforge.net/projects/pydev/files/pydev/ Eclipse + Pydev 配置Python开发环境 JDK安装http://jingyan ... 
