PyCoder 515

PyCon US 2022 来了 原文: PyCoder’s Weekly - Issue #515 220310 Zoom.Quiet(大妈) 用时 13 分钟 完成快译 220310 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. 超越 “Beginner” Python 的可选姿势 REAL PYTHON PODCAST It’s episode 100 of the Real Python Podcast 🎉 This week you’ll learn how to define Python functions that accept optional arguments or default values, and you’ll get tips for going beyond the beginner stage with Python. (是也乎: 突破小鲜肉… ) 如何在 Python 中发现/并修复 漏洞 ADAM GOLDSCHMIDT “I decided to deepen my knowledge in this field and explore cache poisoning vulnerabilities in the open source domain. I focused my research on the most popular web frameworks, such as Flask, Bottle, and Tornado. Eventually, I found and fixed a vulnerability in Python.” Data Elixir: 数据科学通讯 DATA ELIXIR SPONSOR Data Elixir is an email newsletter that keeps you on top of the latest tools and trends in Data Science. Covers machine learning, data visualization, analytics, and strategy. Data Elixir: Data Science Newsletter (是也乎: 就象 RoR 逈 Django 迁移, Pythoneer 逈 Elixir 转向也是正义的 ) 数据科学团队/代码审查指南 TIM HOPPER Although written for Data Science teams, a good article on why any team of coders should do code reviews. How to do them, what to look for, and how to improve your code. (是也乎: 所以, code review 也内卷分化为不同领域的专门嗯嗯嗯了 ) PyCon US 2022 时间表已发布 PYCON.BLOGSPOT.COM Django 4.0.3 Bug Fix 发布 DJANGO SOFTWARE FOUNDATION 探讨/吐糟 Discussions ...

2022-03-10 · 4 min · 1719 words · ZoomQuiet

PyCoder 514

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 ...

2022-03-02 · 4 min · 1791 words · ZoomQuiet

PyCoder 513

百倍加速 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 ) ...

2022-02-22 · 5 min · 2026 words · ZoomQuiet

PyCoder 512

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 ...

2022-02-17 · 4 min · 1714 words · ZoomQuiet