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