501-510¶
Issue #501 Python Argument Defaults, Data Viz With Dash, Rats in VR, and More Nov. 30, 2021¶
CPython Dev in Residence: Weekly Report, November 22–28
A short review of try/except, exception handling in asyncio today, and the future of asyncio error handling.
ŁUKASZ LANGA
一些零碎的絮絮叨叨
Issue #502 Advent of Python, Error Message Styles, Django 4.0, and More Dec. 7, 2021¶
Best Way to “Swap” Words (Multiple Characters) in a String?
STACK OVERFLOW
replace不就挺好的嘛
Prettify Your Data Structures With Pretty Print in Python
The pprint module, Python’s data pretty printer, is a useful part of the standard library. You can work with it for debugging data structures and increasing the readability of your output. In this tutorial, you’ll find that pprint is both straightforward to use and also highly customizable.
REAL PYTHON
强烈建议变成标准库
Issue #503 Python Feature Chronology, Hosting Django Apps, PyPI User Feedback, and More Dec. 14, 2021¶
It’s Time to Stop Using Python 3.6
“Python 3.6 will stop getting security updates in December 2021. Given the existence of 3.7, 3.8, 3.9, and 3.10, you really should upgrade.”
ITAMAR TURNER-TRAURING
3.6都要不支持了,发展的好快啊
Edifice: A Declarative UI Library
PYEDIFICE.ORG
还是需要一定的学习成本的
Issue #504 Python Exceptions, Poetry, Steering Council Elections, and More Dec. 21, 2021¶
Using JavaScript-style Async Promises in Python
MIGUEL GRINBERG
pip install promisio
python的协程确实设计的不好,也没人用,但是也不能照着js抄吧
所以到底解决了没
Issue #505 The "zipimport" Module, Fast Async HTTP Requests, Versioning, PEP 669, and More Dec. 28, 2021¶
Should You Use Upper Bound Version Constraints?
package>=7 vs package>=7,<8: Should you be adding upper bounds to dependency version constraints in Python packages?
HENRY SCHREINER • Shared by Henry Schreiner
最好不要限制版本上限,这会限制版本未来的更新
Good Python Projects to Read for Examples of Modern Python? HACKER NEWS
打不开
Issue #506 Build a Social Network With Django, Make Your Own Linter, Log Injections Attacks, and More Jan. 4, 2022¶
Python Type Hints: How to Handle Optional Imports
This post is not about importing typing.Optional, but instead imports that are themselves optional. Libraries often have optional dependencies, and the code should work whether or not the import is there. ADAM JOHNSON
Reading Tracebacks in Python
When exceptions go unhandled, Python prints a traceback. Tracebacks are read from the bottom upward. The last line describes what happened and lines above describe where it happened. TREY HUNNER
阅
Issue #507 Django Front Ends, Language of the Year, PSF News, and More Jan. 11, 2022¶
Yamale: A Schema and Validator for YAML
GITHUB.COM/23ANDME
yaml校验,不防范恶意攻击
Issue #508 Object Subscriptions Deep-Dive, Django Survey Results, Pip Caching, and More Jan. 18, 2022¶
5 Ways to Use Python on an iPad
“It turns out that it’s actually pretty easy to code in Python on the iPad, especially if you’re willing to work in Jupyter Notebooks. […] Here are five ways you can code in Python on any iPad right now.” DAVID AMOS • Shared by David Amos
几个APP的介绍
Don’t Wrap Instance Methods With the functools.lru_cache Decorator
Wrapping instance method in Python suffers from one giant gotcha—class instances don’t get garbage collected properly. This post explores that. REDOWAN DELOWAR • Shared by Redowan Delowar
即使缓存了,也不要max_size=None
teyit: Formatter for Your Python Unit Tests
GITHUB.COM/ISIDENTICAL
没啥用啊,看来来改动了,但是又没完全改
Issue #509 PEP 646 Accepted, Strict Function Parameters, Solving Wordle, and More Jan. 25, 2022¶
PEP 646: Variadic Generics Was Accepted
This PEP introduces TypeVarTuple, enabling parameterisation with an arbitrary number of types. For example, it allows the type of array-like structures in numerical computing libraries such as NumPy and TensorFlow to be parameterised with the array shape, enabling static type checkers to catch shape-related bugs. The PEP was recently accepted by the Steering Council. PYTHON.ORG
没仔细看,不过已经被accept了
PEP 679: Allow Parentheses in assert Statements
“It is a common user mistake when using the form of the assert statement that includes the error message to surround it with parentheses. Unfortunately, this mistake passes undetected as the assert will always pass, because it is interpreted as an assert statement where the expression is a two-tuple, which always has truth-y value.” PYTHON.ORG
有点意思
Python Type Hints: How to Type a Descriptor
“The descriptor protocol allow us to completely customize attribute access. Python’s documentation describes the protocol with types involved described with words. Let’s look at how we can write those as type hints.” ADAM JOHNSON
没自信看
Issue #510 Python JIT, Security Pitfalls, macOS Deprecates Python 2, Black Formatter Stable Release, and More Feb. 1, 2022¶
What Is a JIT and How Can Pyjion Speed Up Your Python?
How can you can speed up Python? Have you thought of using a JIT (Just-In-Time Compiler)? This week on the show, we have Real Python author and previous guest Anthony Shaw to talk about his project Pyjion, a drop-in JIT compiler for CPython 3.10. REAL PYTHON PODCAST
1
10 Unknown Security Pitfalls for Python
“In this blog post, we share 10 security pitfalls we encountered in real-world Python projects. We chose pitfalls that we believe are less known in the developer community.” DENNIS BRINKROLF
还是挺好的文章,讲了一些不被人注意可能出问题的小点
konsole: Readable, Pleasing Console Output
GITHUB.COM/APPAREBIT • Shared by Robert Grimm
可以,但没必要