511-520¶
Issue #511 typing.Protocol, args and kwargs, CPython 3.11.0a5 Released, and More Feb. 8, 2022¶
Creating Beautiful Tracebacks with Python’s Exception Hooks
“We all spend a good chunk of our time debugging, sifting through logs, or reading tracebacks. Each of these can be difficult and time-consuming and in this article, we will focus on making the last one—dealing with tracebacks and exceptions—as easy and efficient as possible.” MARTIN HEINZ • Shared by Martin Heinz
自定义异常处理钩子,练手可以,实际项目大概率用不到
BeeWare: Write Python, Run Everywhere Using Native UIs
BEEWARE.ORG
还是PySimpleGUI好用,pyhon干gui实在是太挫了
Issue #512 Unit Test Docs, Python zipfile, Django Runs Black, and More Feb. 15, 2022¶
Documentation Unit Tests
Interesting approach to keeping documentation and code in sync: introspecting the code to figure out what needs to be documented, then parsing the documentation to see if each item has been covered. SIMON WILLISON
没仔细看
PEP 673: Self Type Was Accepted
This PEP introduces a simple and intuitive way to annotate methods that return an instance of their class. This behaves the same as the TypeVar-based approach specified in PEP 484 but is more concise and easier to follow. Related Twitter thread by core dev Raymond Hettinger. PYTHON.ORG
行
Upcoming Python Feature PEPs
“These PEPs are a great way of getting the freshest info about what might be included in the upcoming Python releases. So, in this article we will go over all the proposals that are going to bring some exciting new Python features in a near future!” MARTIN HEINZ
这个pep https://python.org/dev/peps/pep-0654/ 咋看着这么狂野。 看了一下pep还是很合理的,很多时候需要一次raise多个不同的exception,目前是没办法做的。 不过这玩意等实现估计得要3.11往后了吧
Issue #513 Faster Code, Multiple Constructors, Dockerizing Django, and More Feb. 22, 2022¶
10 Tools I Wish I Knew When I Started Working With Python
Learn about how venvs, flake8, black, isort, pytest, commitizen, semantic-release, pre-commit hooks, and Github Actions work together! KEVIN YLU
提到了pytest,看来pytest还是比自带的unittest好用啊
Issue #514 Assert, Downloading Concurrently, Troubleshooting, and More March 1, 2022¶
Python’s Assert: Debug and Test Your Code Like a Pro
Learn how to use Python’s assert statement to document, debug, and test code in development.
REAL PYTHON
还是很常用的
Issue #515 Optional Arguments, Fixing a Vulnerability, Code Reviews, and More March 8, 2022¶
debugpy: Debug Adapter Protocol for Python
GITHUB.COM/MICROSOFT
看起来是适配了微软的lsp的debug器
Issue #516 CLIs, Cython, 3.11's Better Error Messages, and More March 15, 2022¶
Python 3.11 Preview: Even Better Error Messages
Python 3.11 will be released in October 2022. This article explores the more precise error messages now available in the latest alpha release. REAL PYTHON
还有半年才发布,但是新特性还是非常吸引人的
目前宣布的 Python 3.11 的一些亮点包括:
增强的错误消息,这将帮助您更有效地调试代码
异常组,允许程序同时引发和处理多个异常
优化,承诺使 Python 3.11 比以前的版本快得多
静态类型改进,可以让您更准确地注释代码
Issue #517 Lists vs Tuples, Building Hash Tables, Frame-Based Editing, and More March 22, 2022¶
How to Create a Generator Function
Generators are iterators that don’t take up the memory. Have a function that returns a list? You may be able to turn it into a generator function by replacing the append() calls with yield statements. TREY HUNNER
使用yield关键字来吧普通的函数转换为生成器函数
Issue #518 James Webb Telescope, Large JSON Files, Pillow, and More March 29, 2022¶
Processing Large JSON Files Without Running Out of Memory
Loading complete JSON files into Python can use too much memory, leading to slowness or crashes. The solution: process JSON data one chunk at a time. ITAMAR TURNER-TRAURING
说到底就是第三方json库来流式处理大文件 https://github.com/ICRAR/ijson
Image Processing With the Python Pillow Library
Learn how to use the Python Pillow library to deal with images. Combine this with some NumPy for image processing and to creating animations. REAL PYTHON
处理dpi这方面还是比OpenCV好用的,其他的我还是选择OpenCV
pointers.py: Bringing the Hell of Pointers to Python
GITHUB.COM/ZEROINTENSITY
返祖现象?
果然,就一个issue还是这个 https://github.com/ZeroIntensity/pointers.py/issues/1
Issue #519 Levenshtein Distances, urllib, Python's Performance, and More April 5, 2022¶
pokete: A Terminal Based Pokemon-Like Game
GITHUB.COM/LXGR-LINUX
Issue #520 Oregon Trail, f-Strings, PyLadies Auction, and More April 12, 2022¶
YAML: The Missing Battery in Python
In this tutorial, you’ll learn all about working with YAML in Python. By the end of it, you’ll know about the available libraries, their strengths and weaknesses, and the advanced and potentially dangerous features of YAML. You’ll also serialize Python objects and create a YAML syntax highlighter. REAL PYTHON
json的一个问题就是一个大的对象需要一次性load进来,不能像txt一样一行一行写