周刊
各种来源的…
background
世界高速变化
goal
定期 review 一周以来主要变化
trac
汇集各种渠道的周刊, 以及自己每周内省小结吧…
refer.
…TBD
各种来源的…
世界高速变化
定期 review 一周以来主要变化
汇集各种渠道的周刊, 以及自己每周内省小结吧…
…TBD
Numba 两行代码13x加速 原文: PyCoder’s Weekly - Issue #514 220302 Zoom.Quiet(大妈) 用时 13 分钟 完成快译 220302 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. Python’s 断言: 像专业人士一样调试和测试代码 REAL PYTHON Learn how to use Python’s assert statement to document, debug, and test code in development. (是也乎: ) 如何从古腾堡项目同时下载多个书籍 JASON BROWNLEE Using threads to download multiple books from Project Gutenberg at the same time. Troubleshoot Python Application Performance Errors Fast With Datadog’s end-to-end Tracing Datadog’s APM generates detailed flame graphs to help you identify bottlenecks and latency in your code. Navigate seamlessly between Python application traces to relevant logs and metrics to troubleshoot and resolve the application error without switching tools or context. Try Datadog APM free → DATADOGSPONSOR 用 Pandas, Seaborn and Ipywidgets 实现交互式可视化 ZOLTAN GUBA Creating interactive visual output using ipywidgets. (是也乎: 其实动态影响的可视化没有多少应用场景, 一般政府大楼中的大数据屏,都不是触屏, 而且也没有动机去改变什么参数… ) PyPy v7.3.8 发布, 支持 Python 2.7, 3.7-3.9 PYPY.ORG (是也乎: 是的, 广大 Py 2.7 项目依然可以稳定使用 ) Python Core 将 Bug 追踪迁移入 Github PYTHON.ORG (是也乎: 是的, 放弃了开源系统, 还是给有钱的 M$ 平台来追踪吧, 反正免费的. ) Tomli TOML Parser 将进入 Python 3.11 Standard Library GITHUB.COM/HUKKIN ...
百倍加速 Python API 原文: PyCoder’s Weekly - Issue #513 220222 Zoom.Quiet(大妈) 用时 13 分钟 完成快译 220222 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. 如何优化 Python API 服务器代码 100x VADIM MARKOVTSEV • Shared by Vadim Markovtsev Tricks we used to speed up calls to our analytical API written in Python: asyncio, SQLAlchemy, asyncpg, Cython plugins, improved data structures, and replaced some Pandas with NumPy. (是也乎: 在需要时… 反正都是些祖传手艺, 在电脑只有1K内存时… ) 在 Python 类中提供多个构造函数 REAL PYTHON Learn how to provide multiple constructors in your Python classes, including: checking argument types, using default argument values, writing class methods, and implementing single-dispatch methods. (是也乎: 模式匹配哪, 这是函式语言基本能力, 在 Python 中也可以模拟出来了… 基于 singledispatchmethod from datetime import date from functools import singledispatchmethod class BirthInfo: @singledispatchmethod def __init__(self, birth_date): raise ValueError(f"unsupported date format: {birth_date}") @__init__.register(date) def _from_date(self, birth_date): self.date = birth_date @__init__.register(str) def _from_isoformat(self, birth_date): self.date = date.fromisoformat(birth_date) @__init__.register(int) @__init__.register(float) def _from_timestamp(self, birth_date): self.date = date.fromtimestamp(birth_date) def age(self): return date.today().year - self.date.year ) ...
Twisted 22.1.0 发布… 原文: PyCoder’s Weekly - Issue #512 220217 Zoom.Quiet(大妈) 用时 13 分钟 完成快译 220217 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. 文档 Unit Tests SIMON WILLISON 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. 改善您的 Django 和 Python 开发者体验 REAL PYTHON PODCAST How often have you thought about your Developer Experience (DX)? How do you improve your workflow, find documentation, and simplify code formatting? This week on the show, Adam Johnson is here to talk about his new book, “Boost Your Django DX.” (是也乎: UX 重要, 还是 DX 重要? ) Python’s zipfile: 有效地操作 ZIP 文件 REAL PYTHON In this guided tutorial, you’ll learn how to manipulate ZIP files using Python’s zipfile module from the standard library. Through hands-on examples, you’ll learn how to read, write, compress, and extract files from your ZIP files quickly. (是也乎: ) PEP 673: 自我类型已接受 PYTHON.ORG 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. Twisted 22.1.0 发布 TWISTEDMATRIX.COM Twisted, the event framework for internet applications, has announced the release of 22.1.0. Mainly a bugfix release. (是也乎: 淦…. 还在稳定升级, 超长寿 巨型模块… ) Django 项目用 Black 重新格式化整个代码库 GITHUB.COM/DJANGO Related discussion on Hacker News. (是也乎: 淦…够卷的… 这是想用 ) 探讨/吐糟 Discussions ...
简单将GraphQL接口添加到DRF应用程序 原文: PyCoder’s Weekly - Issue #511 220209 Zoom.Quiet(大妈) 用时 13 分钟 完成快译 220209 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. 用可选参数定义Python函数 REAL PYTHON COURSE Learn about Python optional arguments and how to define functions with default values. You’ll also see how to create functions that accept any number of arguments using *args and **kwargs. (是也乎: 其实, 默认值本身也是一种漏洞… ) typing.Protocol 支持不同 Python版本 HYNEK SCHLAWACK How to seamlessly support typing.Protocol on Python versions older and newer than 3.8. At the same time. (是也乎: import sys if sys.version_info >= (3, 10): from typing import ParamSpec else: from typing_extensions import ParamSpec 这类补丁何时是个头? ) 更好的Pygame主循环 GLYPH LEFKOWITZ Improving your game’s main loop for smoother gameplay that takes less battery power: “Now your players’ laptops run cool while playing, and the graphics don’t have ugly tearing artifacts any more!” (是也乎: ) GitHub 语言和其它开发事务调查 GITHUB.COM • Shared by Ian Currie JavaScript retains the top spot, Python keeps 2nd place gained in 2019 over Java, which holds in 3rd. Typescript continues 4th after racing up from 2017 from 10th to 4th in 2020. JavaScript + TypeScript seem to put that way ahead in terms of amount of code on GitHub. (是也乎: top5 里有三个都是 微软 一家的… 猜中国有多少? ) Python 新闻/2022年1月新增了什么?? REAL PYTHON In January 2022, Black came out of Beta, IPython 8.0 was released, PEP 665 was rejected, and last but not least, a fifteen-year-old bug was fixed. In this article, you’ll get the details on these important happenings in the world of Python. (是也乎: ) Python in Visual Studio Code – February 2022 发布 MICROSOFT.COM This release includes: smart selection, folding support, improvements to the Python interpreters list, improvements when using Anaconda. (是也乎: 反正, 俺是关闭的 ) CPython 3.11.0a5 可用 CPYTHON DEV BLOG “We needed to tame some angry buildbots, but after a small fight, we won with just some scratches! Here you have a shiny new alpha release: Python 3.11.0a5.” 探讨/吐糟 Discussions ...