601-610¶
Issue #601 Ptpython, Ruff Formatter, Lambdas, and More Oct. 31, 2023¶
Cite
PEP 703 (Making the GIL Optional in CPython) Acceptance
PYTHON.ORG
PEP已经被接受,看怎么实现了
Cite
When Should You Upgrade to Python 3.12?
Python 3.12 has been released—when should you switch to using it?
ITAMAR TURNER-TRAURING
文章中说的很合理,如果你的Python版本落后太多,那么升级到最新的3.12就太可怕了,这种情况下,应该从3.8、3.9、3.10到3.11、3.12逐步升级上来。升级其实主要顾虑的就是第三方库的兼容性,还有就是项目中一些编译好的.so需要重新编译
Issue #602 Porting from setup.py, Hangman, Timestamp Performance, and More Nov. 7, 2023¶
Cite
How to Use Type Hints for Multiple Return Types in Python
In this tutorial, you’ll learn to specify multiple return types using type hints in Python. You’ll cover working with one or several pieces of data, defining type aliases, and type checking with a third-party static type checker tool.
REAL PYTHON
太长不看
Cite
Do Not Use requirements.txt
This article discusses why using a requirements.txt file and pip is insufficient for handling dependencies on back end services. Miikka recommends Poetry instead.
MIIKKA KOSKINEN
改用Poetry
Cite
PEP 702: Marking Deprecations Using the Type System
Python 3.13 will include a decorator to indicate that content has been deprecated. This PEP outlines the specification and use case.
PYTHON.ORG
弃用
Cite
Why Is the Django Admin “Ugly”?
When Vince was talking with people at Djangocon US, one question kept coming up: “why is the Django admin so ‘ugly’?”
VINCE SALVINO
因为是给内部人员用的,所以不需要太好看,而且可以自定义
Issue #603 SciPy Builds, Packaging Tools, Document with ChatGPT, and More Nov. 14, 2023¶
Cite
PEP 733: An Evaluation of Python’s Public C API
This is an informational PEP describing the shared public view of the C API in Python. It talks about why the C API exists, who the stakeholders are, and problems with the interface.
PYTHON.ORG
一个文档性的PEP,讲述了Python的C API的历史,以及现在的问题,以及未来的发展方向
Issue #604 Learning Python in the Age of AI, Cores Dev Using Typing, Creating A Debugger, and More Nov. 21, 2023¶
Cite
marcel: A Modern Shell
GITHUB.COM/GEOPHILE
纯Python写的
Issue #605 Inline Dependencies, Conway's Game of Life, Bug Categories, and More Nov. 28, 2023¶
Cite
Inline Dependencies for Small Python Scripts
Sabs wanted the ability to specify dependencies inside a single Python script, and although there are PEPs on this topic, their implementation is a ways off. Sabs decided to solve this problem directly: introducing pip.wtf a code snippet you copy into your script that does dependency loading through a function call.
PIP.WTF
看明白了想干嘛,没看明白怎么干
Issue #606 Advent of Code, Thread Pools, Jupyter AI, and More Dec. 5, 2023¶
Cite
Django 5.0 Released
DJANGO SOFTWARE FOUNDATION
Django的生态还是好啊,转眼看看Flask也发布到3.0了
Cite
CPython Internals: Understanding the Role of PyObject Understand how objects are implemented in CPython and how CPython emulates Inheritance and Polymorphism in C using struct embedding. ABHINAV UPADHYAY
1
Cite
tracemem: Memory Tracker for Python Session
GITHUB.COM/NYGGUS • Shared by Marcin
简单的内存查看和记录功能
Issue #607 Code Reviews, Polars, PSF Communication Manager, and More Dec. 12, 2023¶
Cite
Python 3.12.1 Released
CPYTHON DEV BLOG
1
Cite
An Open Letter to the Python Software Foundation
PYTHONAFRICA.BLOGSPOT.COM
非洲用户的一封信,希望PSF能够更多的关注非洲用户
Cite
flask-muck: RESTful APIs Using Flask and SqlAlchemy
GITHUB.COM/DTIESLING
快速生成RESTful API的工具,提供增删改查的功能,可以,但没必要
Issue #608 Hangman, TYPE_CHECKING, match, and More Dec. 19, 2023¶
Cite
Why if TYPE_CHECKING?
“Typechecking is brittle yet important”, learn more about where it works and where it doesn’t and what that might mean for your code.
VICKI BOYKIS
读一下这篇文章,讲了Python的类型提示的历史,以及为什么要用类型提示,以及类型提示的局限性 里面提到了Python的基本数据类型包括
- int, float, complex
- str
- bytes
- tuple
- frozenset
- bool
- array
- bytearray
- list
- set
- dict
TYPE_CHECKING主要用于解决循环引用,参考这个回答 再参考关于类型检查会导致循环引用的讨论
Cite
Real-World match/case
The match statement was added in Python 3.10. This article covers a real-world example use case and shows its power.
NED BATCHELDER
match case的酷炫用法
# Check the structure of the payload:
match event:
case {
"issue": {"closed_at": closed},
"comment": {"created_at": commented},
} if closed == commented:
# This is a "Close with comment" comment. Don't do anything for the
# comment, because we'll also get a "pull request closed" event at
# the same time, and it will do whatever we need.
pass
case {"sender": {"login": who}} if who == get_bot_username():
# When the bot comments on a pull request, it causes an event, which
# gets sent to webhooks, including us. We don't have to do anything
# for our own comment events.
pass
case {"issue": {"pull_request": _}}:
# The comment is on a pull request. Process it.
return process_pull_request_comment(event)
Issue #609 Best of PyCoder's 2023 Dec. 26, 2023¶
Cite
How to Annotate Methods That Return self
In this tutorial, you’ll learn how to use the Self type hint in Python to annotate methods that return an instance of their own class. You’ll gain hands-on experience with type hints and annotations of methods that return an instance of their class, making your code more readable and maintainable.
REAL PYTHON
from typing_extensions import Self
Cite
nicegui: Create Web-Based UI With Python
GITHUB.COM/ZAUBERZEUG
这个star数挺多,文档是https://nicegui.io/documentation,用什么q widget,vue的写法,学习成本有点高
Cite
Cross Platform GUI Framework Based on HTML/CSS
GITHUB.COM/SCRIPTIOT • Shared by dragondjf
看着挺靠谱的,一年前已经不维护了
Issue #610 Flask, Python JIT, Discoveries in 2023, and More Jan. 2, 2024¶
Cite
Build a Scalable Flask Web Project From Scratch
In this tutorial, you’ll explore the process of creating a boilerplate for a Flask web project. It’s a great starting point for any scalable Flask web app that you wish to develop in the future, from basic web pages to complex web applications.
REAL PYTHON
简单入门
Cite
JIT Coming to Python 3.13
Slides related to the upcoming JIT commit for Python 3.13. Note, GitHub paginates it if you don’t download it, so click the “More Pages” button to keep reading.
GITHUB.COM/BRANDTBUCHER
1
Cite
Raise the Right Exceptions
Knowing when to raise the right exception is important, but often you don’t have to: Python might do it for you.
JAMES BENNETT
一些讨论