课程大纲
Python Overview
- Python in one slide
- Python Implementations
- The good in Python
- The bad in Python
- Python Performance
- Pythonic
- Python IDEs
IPython (Notebook) Introduction
- What’s new in IPython
- auto completion
- help and interuption
- run external file
- run script in clipboard
- hotkey
- magic command
- matlotlib integration
- variable operations
- command logging
- shell operations and python integration
- notebook feature
First Python
- First Python script example
- Code line formatting
- Comments and Documentation
- Keywords overview
- Operations overview,
- Conditions, Loops, Functions, import examples
(Cover keywords: True, False, return, continue, for, def, import, pass, if, elif)
Operations
- Operation overview
- is and ==
- Some differences with C/C++
- Variable initialization
- Swap
(Cover keywords: is, None)
Condition
- Condition overview
- Nature of “and” and “or”
- Assert
(Cover keywords: if, else, is, not, assert, and, or, build-in functions: isinstance)
Loops
- Loop overview
- Lazy loop
- enumerate()
- else statement
- loop best practice
(Cover keywords: for, while, continue, break, in, else, yield. build-in functions: enumerate)
String
- String encoding and Unicode
- String slicing
- String combination
- String formatting
- Large String operation
- str() and repr()
Native datatypes
- Overview
- Operations
- Tuple
- List
- range, xrange
- Dict
- View Object
- Immutable vs. mutable
- sort vs. sorted
- list comprehension
- copy and deepcopy
- selct suitable data structure
(Cover keywords: delete, build-in functions: id, list, dict, set, tuple, map)
Collections
- namedtuple
- OrderedDict
- defaultdict
Function
- Something differences with C/C++
- Optional and Named Arguments
- Pass value or by reference
- Type check
- Default argument trap
- Lambda
(Cover keywords: lambda)
Module and Package
- Module file structure
- From import
- Absolute import
- Import mechanism
(Cover keywords: import)
Naming lookup
- Difference between Python and C/C++
- Local namespace
- Global namespace
- eval()
- Nested namespace
- Build-in namespace
(Cover keywords: global, nonlocal)
Exceptional
- Handling Exceptions
- Try-except-else-finally
- finally trap
- Using sys.modules
- With statement
(Cover keywords: try, except, else, finally, raise, with, as)
Objects and OO
- Importing using From Import
- Defining classes
- Instantiating Classes
- Garbage Collection
- Object Reference with getattr
- Special Class Methods: get and set items
- Advanced Class Methods
- Class Attributes
- Private Functions
Advanced topics above class levels
- Everything is object
- Build-in objects
- About __init__()
- Self
- Subclassing build-in types
- Accessing Methods from Superclasses
- Python MRO
- Descriptors and Properties
- Slots
- Python object protocols
- Metaclass
- Override Operator
Core Python Mechanism I
- Iterator inside
- Write a iterator via class
- Generator != Function
- Generator = iterator?
- Generator Inside
- Context manager
Core Python Mechanism II
- Function decorator
- Decorator implementation
- Multiple decorators
- Parameterized decorator
- Decorator mechanism
Python3核心变化
1. 字符串与类变化
2. 遍历器解包与变参调用
3. 变量与函数标注
4. 异常链
5. 生成器委托
Regular Expression (Optional)
- Regular expression syntax in Python
- Advanced Knowledge
- Methods and libraries
- Examples and Practices
Unit Test Framework [Optional]
- doc test
- unittest
- nose
- pytest
- behave
- robot framework
- others framework