PEP 646+679 已接受

原文: PyCoder's Weekly - Issue #509


  • 220126 Zoom.Quiet(大妈) 用时 13 分钟 完成快译
  • 220126 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄.

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.

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.



关键还是随机数, 如何真正随机



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

Learn about keyword-only and positional-only parameters and see how using strict function signatures can help you write more resilient code.

Tips on how to design and organize scientific Python code.


还是最佳实践, 叕一组






Articles, Tutorials and Talks

Are you looking for a project to practice your Django skills? Designing the fundamental interactions of a social network is an instructive way to explore models and relationships while learning advanced Django skills. This week on the show, previous guest Martin Breuss talks about his new four-part tutorial series, “Build a Social Network With Django.”



SNS 哪, 当年 RoR 起家的本事


“Wordle seems to be trending and it got me thinking of what would be the best algorithm to solve it. I decided to do a naive implementation in Deepnote with Python that only uses NLTK’s list of all english words and base letter frequencies in english texts. This way, I was able to solve the January 18 challenge, but I used up all available attempts.”


拼写游戏哪, 对中文无感


In this course, you’ll learn how to use the development environment included with your Python installation. Python IDLE is a small program that packs a big punch! You’ll learn how to use Python IDLE to interact with Python directly, work with Python files, and improve your development workflow.



IDLE 真的上古神器, 除了中文支持不好,其它没什么毛病...


You can use the % modulo operator for string formatting in Python. It’s a commonly used technique in older Python versions, especially in Python 2. Therefore, you might see it when digging into existing code bases, and it can be helpful to understand how it works.



虽然提供了越来越多格式化形式, 还是传统的好懂些.



How do you make your Django app fast? You measure what is slow, scale your system when necessary, and use a combination of fast database queries and strategic caching. This artcile explores those topics and more to help you get a performant Django app.


多数情况都是 数据库拖慢了 Django


Accurately static typing decorators in Python is tricky. The wrapper function obfuscates type information required to statically determine the types of the wrapped function parameters. Here’s how you can circumnavigate that.


Decorators 几乎成了Python 的作弊器...


“The descriptor protocol allow us to completely customize attribute access. Python’s documentation describes the protocol with types involved described with words. Let’s look at how we can write those as type hints.”

An introduction to the Python descriptor protocol, with some example use cases. The descriptor protocol allows you to implement custom logic when a variable is accessed, or assigned a new value.

Using the PyYAML library to safely read and write YAML with any tags, in a way that’s as straightforward as interacting with built-in types.


TOML 还是有机会的...


“Sometimes the type of the returned value in a function depend on the type of the arguments in ways that can’t be captured with a Union.”


几个独立发行版 Python 都折腾出自己独有的高招


不过, 整体趋势都是越来越象 C++


Vectorization allows you to speed up processing of homogeneous data in Python. Learn what it means, when it applies, and how to do it.




Discussing an interesting trick which adds support for infix operators in Python, e.g. 5 |add| 6






Interesting Projects, Tools and Libraries, Projects & Code


窗口管理器? 果断得通过 C 接口兼容所有系统...






还没发布 1.0, 如果兼容 gRPC 那就爽快了


📆🐍 活动/大会

Events, MeetUp 真的是全球线下活动组织中心

⋅ PyCamp Leipzig 2022 January 29 to January 31, 2022


❤️ Happy Pythonic ;-(大妈私人无责任播报)




去年开始有小伙伴加入承担 pythonisa 周刊的翻译, 从来没提醒过, 可就这么默默坚持下来了...


[皱眉]每周新闻资讯 怎么能错过 
    what f**k 还能这样玩? 还有这东西?

无法同意更多... 很多社区贡献看起来辛苦, 其实受益最多的, 就是主动承担者也.

好文笔,感叹号年度配额: 1/3


(邮件列表地址, 当成正常邮件发送邮件就好, 不用注册, 不用翻越...)


就是四处 是也乎,( ̄▽ ̄) 的那个大妈:

私自嗯哼: ZoomQuiet (订阅号: ZoomQuiet42)
公开课程: 蟒营 (订阅号: Mainium)
历史吐糟: Chaos42 (订阅号 PythoniCamp)

as 创始组织者:
    PyChina (订阅号: PyChinaOrg)
        GDG珠海 (订阅号: GDG-ZhuHai)
        TFUG珠海 (订阅号: ZH_TFUG)



关于 ~ DebugUself with DAMA ;-)
点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

订阅 substack 体验古早写作:

关注公众号, 持续获得相关各种嗯哼:


**2021.01.11** 因大妈再次创业暂停定期开设, 转换为预约触发:
  • + 扫描预约入群, 学员每满 42 人即启动新一期训练营 ;-)
  • 101camp22.7
  • + 任何问题, 随时邮件提问可也: