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 系列之 并行编程
进程和线程 进程是程序运行的实例.一个进程里面可以包含多个线程,因此同一进程下的多个线程之间可以共享线程内的所有资源,它是操作系统动态运行的基本单元:每一个线程是进程下的一个实例,可以动态调度和独立运 ...
随机推荐
- IOS中调用系统的电话、短信、邮件、浏览功能
iOS开发系列--通讯录.蓝牙.内购.GameCenter.iCloud.Passbook系统服务开发汇总 2015-01-13 09:16 by KenshinCui, 26990 阅读, 35 评 ...
- IOS 开发qq登陆界面
// // ViewController.m // QQUI_bydfg // // Created by Kevin_dfg on 16/4/15. // Copyright © 2016年 ...
- 【usaco】patrol
很长时间都没想出来的简单题,看了题解才写出来,还是naive 原题: FJ有个农场,其中有n块土地,由m条边连起来.FJ的养牛场在土地1,在土地n有个新开张的雪糕店.Bessie经常偷偷溜到雪糕店,当 ...
- 用max-width来防止图片溢出---不兼容ie6-----将max-width设置成父元素的宽度,当图片过大时会换行,以及限制图片的宽度。但是如果使用table,仍然可能超出限制。
img{ max-width:100%; height:auto; } 如题.
- EDIUS设置自定义输出的方法
在做后期视频剪辑时,往往根据需求,需要输出不同分辨率格式的视频文件,那在EDIUS中,如何自定义输出设置,使之符合自己的需要呢?下面小编就来详细讲讲EDIUS自定义输出的一二事吧. 当剪辑完影片,设置 ...
- kubernetes centos 安装
1. 安装 yum install -y etcd kubernetes 2. 配置 docker /etc/sysconfig/doc ...
- pythonchallenge关卡破解
第一关:pow(2,38) 第二关: import string table = str.maketrans(string.ascii_lowercase, string.ascii_lowercas ...
- mysql四种事务隔离级的说明
·未提交读(Read Uncommitted):允许脏读,也就是可能读取到其他会话中未提交事务修改的数据 ·提交读(Read Committed):只能读取到已经提交的数据.Oracle等多数数据库默 ...
- 如何查询 Oracle 11g日志
可使用如下语句查询11g告警日志存放路径: --显示DIAGNOSTIC_DEST的位置 1.show parameter DIAGNOSTIC_DEST; ...
- HDP2.4安装(一):Centos7安装
在进入大数据领域来,一直使用微软的Azure HDInsight,当前在中国区仅支持在Windows系统上部署集群,虽然创建的过程很简单,但对于开发人员来说,就是一个黑盒子,在更深入的研究和开发扩展的 ...