最近半年 Gobby 為了學 Python 籌備了 Python 的讀書會
找了各路的人來導讀這本精通 Python|運用簡單的套件進行現代運算
原本我是推薦了Learning Python, 5th Edition,但因為它是英文的沒被採用
"Learning Python" 算是奠定了我 Python 基礎最重要的一本書
有些基本概念忘記了,我還是會翻以前的筆記
不過沒想到這已經是 10 年以前的書啦😲
回到「精通 Python」這本書
雖然只看了一章,但有稍微找一下大家對這本書的想法
《精通 Python 第二版》心得:給入門者的 Python 學習藍圖寫的跟我的想法還蠻接近的
尤其是重新定義了 "Introducing Python" 為「精通 Python」
實在精闢到一個不行
恩,肯定沒錯,一定是如此
不可能不是如此
為了我要導讀的「第十九章 成為 Python 鐵粉」
上週花了點時間看完,並寫下了筆記
好久沒有這樣全神貫注地看書,感覺是還蠻不錯的
書本身是中文的,但我寫中文太慢了,筆記當初就是用英文寫的
有些翻譯我真的不確定他對回去的原文是什麼,就寫了我猜的
這篇文的重點是在「草稿」
所以下面就只是當天我寫下的筆記簡單整理過的版本
斜線的部分是我自己的補充或想法
- Where to find Python code
- Install package
- IDE (plus interactive shell and editor)
- Documentation and naming
- Type Hinting
- Testing (and linting?)
- Debugging
- Logging
- Optimization (sounds more like profiling)
- Algorithm and Data Structure
- Python Distributions
- Source Control
- Distributing Python Program
- Learn more
Where to find Python code
- PyPI
- used to be "cheese shop" from Monty Python
- GitHub Trend
- Popular Python recipes
Install package
- pip
- pipenv = pip + virtualenv
- system package management (Don't. Just Don't. Please)
- conda
- build from source
- poetry
- uv
- pipx (just notice Josix wrote a blog post for it)
IDE (plus interactive shell and editor)
Documentation and naming
- PEP8
- As a programmer, I would suggest reading Clean Code
Type Hinting
Testing (and linting?)
- print
- no print in production
- pylint, pyflakes, flake8, pep8
- for most cases, I would say just use ruff
- testing
- Continuous Integration (CI)
Debugging
- print
vars()
,locals()
,globals()
- decorator
- pdb
pdb -i
pdb -m
- commands
c
s
n
l
p
b
breakpoint()
Logging
- message
- level
- logger
- handler
- formatter
- filter
Optimization (sounds more like profiling)
- "Python 通常很快"
- Idk, even though I'm a Pythonista, I feel many might argue it.
- time, timeit → use them as a decorator, context manager
Algorithm and Data Structure
- list comprehension is faster
- "Algorithm and Data Structure" hmm... 🤔 I can't say you're wrong.
Python Distributions
Source Control
- Mercurial
- Git
init
add
status
commit
commitizen rocks
Distributing Python Program
- nothing insightful in this section
- upload to PyPI
Learn more
- books
- Learning Python
- Websites
- Community
- PyLadies
- PyCons
- local meetups
- Jobs
- you'll find your way out