Python的50道陰影
Transcript of Python的50道陰影
Python 50
• Tim, Python
•
•
File "test.py", line 6 print "yoshi" ^IndentationError: unexpected indent
• Python Tab
• Tab
Parsing
pop pop
• Tab
• Editor Tab
default argument
• Python def argument
•
closure
• closure Python
• reference Python lexical scope)
• closure gc
• 1. class __call__ lexical scope
• 2. functool.partial
Global Variable
• Python Local Global
global
local
• Global
• global
Dead or Alive
• del symbol table reference count -1
• reference count 0 GC, __del__
Circular reference
• 2016 Python
• __del__. Python
• circular reference. weak reference.
• weak reference reference count.
• Python gc
Interface
• interface
• base class Python
List Related
• iterate list
• list
Package
• sudo pip
• virtualenv
• requirements.txt dependency
• setup.py
• pip freeze > requirements.txt
•
•
• Conflict merge
2 == > 3• python 3
• __future__, six
• print_function
• absolute_import
• io.open 2.7 encoding
Quality
• flake8 —install-hook
• commit pep8
• # noqa
inheritance
• super
Any Question?