PyCoder 511

简单将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 ...

2022-02-09 · 5 min · 2193 words · ZoomQuiet

PyCoder 510

Black 终于稳定了 原文: PyCoder’s Weekly - Issue #510 220202 Zoom.Quiet(大妈) 用时 13 分钟 完成快译 220202 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. 咩是 JIT, Pyjion 如何加速你的 Python? REAL PYTHON PODCAST 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. (是也乎: 叕一个加速器, 老爹有压力了… ) Python 的 10 个未知安全陷阱 DENNIS BRINKROLF “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.” 在 Python 中绘制 Mandelbrot Set REAL PYTHON In this tutorial, you’ll visualize the famous Mandelbrot set using Python’s Matplotlib and Pillow libraries. You’ll learn how to draw the fractal in black and white, grayscale, and color. (是也乎: ) Apple 从 macOS Monterey 12.3 中删除了 Python 2.7 APPLE.COM “Python 2.7 was removed from macOS in this update. Developers should use Python 3 or an alternative language instead.” Also see the related discussion on Hacker News. (是也乎: 不容易哪, macOS 系统中的 Python 代码也不少的 ) Black, Python 代码格式化器 稳了 HACKER NEWS The popular Python auto-formatter Black is finally non-beta software. Related discussion on Hacker News and Black’s stability policy doc. Django Security 已经发布: 4.0.2, 3.2.12, and 2.2.27 DJANGO SOFTWARE FOUNDATION Includes fixes for a possible XSS via debug template tag and a denial-of-service possibility in file uploads. Textual v0.1.14 追加 Windows 支持 WILL MCGUGAN 探讨/吐糟 Discussions ...

2022-02-02 · 5 min · 2032 words · ZoomQuiet

PyCoder 509

PEP 646+679 已接受 原文: PyCoder’s Weekly - Issue #509 220126 Zoom.Quiet(大妈) 用时 13 分钟 完成快译 220126 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. PEP 646: 可变参数泛型被接受 PYTHON.ORG 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 构建 骰子 应用程序 REAL PYTHON In this step-by-step project, you’ll build a dice-rolling simulator app with a minimal text-based user interface using Python. The app will simulate the rolling of up to six dice. Each individual die will have six sides. (是也乎: 关键还是随机数, 如何真正随机 ) PEP 679: 允许在断言语句中使用括号 PYTHON.ORG “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 函数参数 SETH MICHAEL LARSON Learn about keyword-only and positional-only parameters and see how using strict function signatures can help you write more resilient code. 科学 Python 的指导设计原则 NSLS-II.GITHUB.IO Tips on how to design and organize scientific Python code. (是也乎: 还是最佳实践, 叕一组 ) 探讨/吐糟 Discussions None ...

2022-01-26 · 4 min · 1933 words · ZoomQuiet

PyCoder 508

FastAPI 0.72.0 来也 原文: PyCoder’s Weekly - Issue #508 220119 Zoom.Quiet(大妈) 用时 13 分钟 完成快译 220119 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. 解析 “[]” 在 Python 中的嗯哼 BRETT CANNON “It’s quite possible you’re not familiar with this formal term, but you are probably familiar with the syntax: the square brackets used for indexing lists and tuples (sequence[4]), accessing the value of a specified dictionary (dictionary[“key”]), etc. To cover this topic we will break up into three parts: general subscriptions, slicing, and multiple arguments.” (是也乎: 老爹真的是在这对符号中玩出花儿了… ) 用 Pipenv 干活 REAL PYTHON COURSE Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip, virtualenv, and requirements.txt. In this course, you’ll go over what problems Pipenv solves and how to manage your Python dependencies with it. (是也乎: ) 70 行 Python 实现概率编程语言 ANDREA COGNOLATO Learn how Probabilistic Programming Languages (PPLs) work by building a simple one in Python. (是也乎: 之前 50 行已经可以构造出不得了的东西了,现在 70行… ) Python News: 2021 12月新鲜事儿? REAL PYTHON The Python community elected its fourth steering council in December 2021. In this article, you’ll catch up on the results of the election as well as news about new maintenance releases of Python and about end-of-life for Python 3.6. 2021 年 Django 开发者调查结果 DSF + JETBRAINS FastAPI 0.72.0 发布 TIANGOLO.COM (是也乎: 叕一个永远不发布 1.0 的好东西 ) 探讨/吐糟 Discussions ...

2022-01-19 · 5 min · 2042 words · ZoomQuiet