about python
函数式编程
- λ演算
- LISP,Erlang
- 尾递归 栈的使用
- 避免防御式编程
ER实体Entity关系relationship
OOP [OOA/D]
- 属性、行为
- 继承、聚合、关联
- 抽象、封装
- 笛卡尔方法论
- 拆分
- 排序
- 处理
- 归并
- 软件工程过程方法论
- 软件生命周期
- RUP统一软件过程管理
- 敏捷开发
- 项目管理(计划、组织、执行、控制)
- 线性级
- 逻辑级
- 架构级
- 工程级
自醒:
- type type(object) -> the object's type
- str str(object='') -> str ,Create a new string object from the given object
- dir dir([object]) -> list of strings,return an alphabetized list of names comprising (some of) the attributes of the given object, and of attributes reachable from it.
- help Help on _Helper in module site object:
very important module:
- os
- sys
- 常量
- 常量无名
- 不需要修饰
- 数
- 整数
- 长整数
- 浮点数
- 复数
- 字符串
- 单引号‘
- 双引号“
- 三引号”’
- 转义符\
- 原生字符串 r"hello world!\n"
- 常用的索引相关操作
- 切割操作
- 邪恶的 eval()
- 变量
- 首字符为字母或下划线
- 其他部分字符为字母、数字、下划线
- 区分大小写
- 数据类型
- 数值
- 字符串
- 线性容器
- 字符串也是一种线性容器
- List
- tuple
- hash容器
- Dict
- set
- None
- 逻辑类型(Ture, False)
- 逻辑行与物理行
- 缩进
- 运算符与表达式
- 流程控制(逻辑控制结构)
- 函数
-
普通
def functionName(): """……
- 函数别名
- lambda
- 闭包
def fun1(a): def fun2(b): return a+b return fun2
-
- OOP
- 异常处理
- 模块与包
#coding=utf-8 #!/usr/bin/python2.7
- 文件和目录操作
open Open a file using the file() type, returns a file object.
write
read
readlines
Seek
Os.listdir
Os.walk
- python的内置容器
- List
- Tuple
- Dict
- Set
- map、reduce、filter
- 迭代器iterator与生成器generator,协同与半协同
- 并行的世界
- 串行与并行
- 阻塞与非阻塞任务
- 共享与冲突
- 多线程与多进程【linux】的区别和特点
- 多进程
- Linux、Unix平台专属
- Fork 【fork()函数通过系统调用创建一个与原来进程几乎完全相同的进程】
-
import os def myfork(): a=1 pid = os.fork() if pid==0: print "this is child process" print a+1 else: print "this is parent process" print a+3 if __name__ == '__main__': myfork()
''' waitpid(...) waitpid(pid, options) -> (pid, status) Wait for completion of a given child process. ''' os.waitpid()
-
- wait
- Waitpid
- pipe\signal
-
''' process communication, resource share ''' # pipe ''' pipe(...) pipe() -> (read_end, write_end) Create a pipe. ''' r,w = os.pipe() # signal import signal
- 守护进程
- 多线程
- Thread
- Threading
- 共享变量与临界资源
- 锁机制