python重修之旅(二)
该博文内容缺失
对于一个职场新人来说,我最不愿意看到的就是办公室政治。工程师不应该是这样的。
模块化的写作不适合我, 所以我决定把重修之旅写成游记形式。就酱。
six
python 2,3 兼容库,致力于实现文件兼容python 2.5 + 语法。
1
2
3
4
5
6
7
8
9
10
11
12
import six
def dispatch_types(value):
# 在 python 3中 six.integar_types == int
# 在 python 2中 six.integar_types == set(int, lang)
if isinstance(value, six.integer_types):
handle_integer(value)
# 同理python2中经典类型和新式类型被合为 six.class_types
elif isinstance(value, six.class_types):
handle_class(value)
elif isinstance(value, six.string_types):
handle_string(value)
abc / abstract base class / 抽象基类
python3 内建库, 用来生成抽象类, python不存在真正的抽象基类,而是通过引入abc
库实现这种
延迟实现的办法。相比之下,Java的interface
关键字就更为直白。
1
2
3
4
5
6
7
8
9
/* 文件名 : NameOfInterface.java */
import java.lang.*;
//引入包
public interface NameOfInterface
{
//任何类型 final, static 字段
//抽象方法
}
matplotlib
wordcloud
jieba 分词库
读“multiprocess for human”的总结
乱七八糟
- 逛 hub的时候看到一个traceback 插件,支持Cocoa,python web,ruby, react。
cursor
:
shlex 库
subprocess 库
traceback 库
读 python-fire
python fire 是今年3月份 google 推出的新式CLI创建工具。与docopt有着完全不同的构建思路。