Day 7: 2018/05/02
Today’s Topic: Python: A byte of python
Today’s Progress: I am already done with most of the basic Python concept, so today we are going to the “more” chapter (page 128), and ends in page 134 (before “what’s next”)
Thoughts: Once we go to the “more” section, the interesting part starts. We talked about the lambda expression, the list comprehension (both are fairly important and useful), and the *args and **args refresher also makes sense. The decorator part needs revisit as well.
- pass “tuples” around → func abc returns (a, b), then you can do x, y = abc(), in which x = a, y = b.
- swap value → a, b = b, a
- in your own class, x[key] → implemnt __getitem__()
- special methods: __init__(self,…), __del__(self), __str__(self) → print(obj), __lt__(self, other) → compare less than, __getitem__(self, key) → x[key], __len__(self)
- single stmt block→ if flag: print(‘yes’)
- lambda function
- list comprehension
- receiving tuples (*) or dictionarys (**) in functions
- To Do: decorators ← re-read
- To Do: python 2 vs python 3 → six, …
Link to work: Link to my own Google drive to show my progress here.