core

Core #

  • Decorators [2]
  • Iterator [2]
  • Generator[2]
    • AsyncGenerator
  • OOP
    • @staticmethod 与 @classmethod[2]
    • 私有变量 [2]
      _xx
      __xx
  • 魔术方法
  • contextmanager[1]

Advanced #

  • for loop 替代[2]
    • builtin
      • max() min()
      • any() all() 用 generator 更快
      • filter() ’’’ python filter(good, lst)
        [num for num in lst if good(num)]
        ’''
      • map() ’’’ python map(change, lst) (change(num) for num in list) ’''
      • zip()
      • itertools

Others #

  • Monkey Patch(猴子补丁)

参考 #

  1. Python 为什么 到处使用 with 关键词 - @contextmanager
  2. up 高天

Others #

Python Monkey Patch 深度解析
python笔记69 - 什么是猴子补丁(Monkey Patch)?