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 系列之 并行编程
进程和线程 进程是程序运行的实例.一个进程里面可以包含多个线程,因此同一进程下的多个线程之间可以共享线程内的所有资源,它是操作系统动态运行的基本单元:每一个线程是进程下的一个实例,可以动态调度和独立运 ...
随机推荐
- android解析json包(接口)
package com.http.test; 02 03 04 import org.apache.http.HttpResponse; 05 import org.apache.http ...
- Hardly Hard
You have been given the task of cutting out a quadrilateral slice of cake out of a larger, rectangul ...
- 回调函数的实现 & 结构体的继承
------------------------------------------------------------------------------------[1]------------- ...
- C++中的单例模式
单例模式也称为单件模式.单子模式,可能是使用最广泛的设计模式.其意图是保证一个类仅有一个实例,并提供一个访问它的全局访问点,该实例被所有程序模块共享.有很多地方需要这样的功能模块,如系统的日志输出,G ...
- Redis server&Client executions
https://www.nuget.org/packages/Microsoft.Extensions.Caching.Redis/ https://github.com/StackExchange/ ...
- android:ScrollView嵌套ListView的问题
在ScrollView中嵌套使用ListView,看起来ListView只会显示一行多一点,不能滑动.ListView的高度怎么改都有问题,与预期不符合.搜索了一些解决方案,我觉得最好不要用这样的设计 ...
- android http 和https请求
private static final int CONNECTION_TIMEOUT = 10000; public static String doHttpGet(String serverURL ...
- A quest for the full InnoDB status
When running InnoDB you are able to dig into the engine internals, look at various gauges and counte ...
- JQuery Pagenation 知识点整理——$.extend(),与$.fn.extend()应用(20150517)
jQuery为开发插件提拱了两个方法,分别是: jQuery.fn.extend(); jQuery.extend(); 一. $.extend()方法 $.extend()方法在JQuery中有两个 ...
- EmEditor处理大文本文件
前段时间新闻网由于用户不当操作.导致三年的报纸栏目内容全部清空.紧急情况下只能求助于SQL数据恢复.但备份的数据文件有500M左右. 首先用的文本编辑器是Notepad++,打开之后软件几乎完全卡死. ...