about python

函数式编程

  • λ演算
  • LISP,Erlang
  • 尾递归 栈的使用
  • 避免防御式编程

ER实体Entity关系relationship


 

OOP [OOA/D]

  1. 属性、行为
  2. 继承、聚合、关联
  3. 抽象、封装

 

  • 笛卡尔方法论
    1. 拆分
    2. 排序
    3. 处理
    4. 归并
  • 软件工程过程方法论
    1. 软件生命周期
    2. RUP统一软件过程管理
    3. 敏捷开发
  • 项目管理(计划、组织、执行、控制)

 


  • 线性级
  • 逻辑级
  • 架构级
  • 工程级

自醒:

  1. type    type(object) -> the object's type
  2. str           str(object='') -> str ,Create a new string object from the given object
  3. 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.
  4. help             Help on _Helper in module site object:

 

very important module:

  • os
  • sys

 

  • 常量
    1. 常量无名
    2. 不需要修饰
    1. 整数
    2. 长整数
    3. 浮点数
    4. 复数  
  • 字符串
    1. 单引号‘
    2. 双引号“
    3. 三引号”’
    4. 转义符\
    5. 原生字符串 r"hello world!\n"
    6. 常用的索引相关操作
    7. 切割操作
    8. 邪恶的 eval()
  • 变量
    1. 首字符为字母或下划线
    2. 其他部分字符为字母、数字、下划线
    3. 区分大小写
  • 数据类型
    1. 数值
    2. 字符串
    3. 线性容器
      • 字符串也是一种线性容器
      • List
      • tuple
    4. hash容器
      • Dict
      • set
    5. None
    6. 逻辑类型(Ture, False)
  • 逻辑行与物理行
  • 缩进
  • 运算符与表达式
  • 流程控制(逻辑控制结构)
  • 函数
    1. 普通

      def functionName():
          """……
    2. 函数别名
    3. lambda
    4. 闭包
      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的内置容器
    1. List
    2. Tuple
    3. Dict
    4. Set
    5. map、reduce、filter
    6. 迭代器iterator与生成器generator,协同与半协同

 


  • 并行的世界
    1. 串行与并行
    2. 阻塞与非阻塞任务
    3. 共享与冲突
    4. 多线程与多进程【linux】的区别和特点

  • 多进程
    1. Linux、Unix平台专属
    2. Fork      【fork()函数通过系统调用创建一个与原来进程几乎完全相同的进程】
      1. 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()

         

    3. wait
    4. Waitpid
    5. pipe\signal
      1. ''' process communication, resource share '''
        
        # pipe
        ''' 
         pipe(...)
            pipe() -> (read_end, write_end)
        
            Create a pipe.
        '''
        r,w = os.pipe()
        
        # signal
        import signal
    6. 守护进程

  • 多线程
    1. Thread
    2. Threading
    3. 共享变量与临界资源
    4. 锁机制
posted @ 2014-07-18 17:17  小开风  阅读(153)  评论(0编辑  收藏  举报