类型提示如何兼容多 Python 版本?

原文: PyCoder's Weekly - Issue #522

pycoder

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

The typing module continues to evolve, with new features in every Python version. This can make it tricky if you’re trying to type code that supports multiple Python versions. Learn just what you can do when you need to support Type Hints in multiple versions.

(是也乎:

Hints

是的,必须精密区分运行时版本...

Py 代码就象 Adnroid 要兼容越来越多设备尺寸...

)

Tips for getting the most out of your visit to PyCon US, the world’s biggest Python conference taking place April 27, 2022 to May 3, 2022 in Salt Lake City, Utah. Whether you’re a first-timer or a seasoned attendee, this guide will help you get ready to have a great PyCon. If you’re attending, stop by the Real Python booth and say hello! :)

(是也乎:

PyCon

白妹主持, 黑人接待, 黄/红/棕/黑 来拜...

非常政治正确.

staff

)

Sometimes you want your Enum objects to reference more than just a single piece of data. You can use a tuple but then you have to de-reference it. This article shows a technique used in http.HTTPStatus that you can do in your own code.

In this video course, you’ll learn how to extend your Django application with a user management system, complete with email sending and third-party authentication.

(是也乎:

Management

其实, 嘦不是给 User 看的, 内置 Admin 足够用了

)

(是也乎:

Ohio ~ 俄亥俄

)


探讨/吐糟

Discussions

(是也乎:

执念, 日常是否用不重要, 重要的是有没有...

)


文章/教程/嗯哼

Articles, Tutorials and Talks

When you’re a beginner you need projects that allow you to practice basic concepts. But do you ever revisit those projects as a more advanced developer? This article looks at one common beginner Python project — implementing Rock Paper Scissors in Python — and how you could approach the game logic from a more advanced perspective.

(是也乎:

即便是 bug 密度不变, 代码减少 ⅔ 也就是 bug 减少了大半.

)

Learn about the Bidict library, a bi-directional dictionary where your keys and your values can both be used to look up an item. This can be a useful tool when dealing with mapped data like country code to country name where you want to look up either side of the relationship.

(是也乎:

终于有了, 以往都是构建/维护两个字典

)

We’ve all been there. Whether you are experimenting with a new fun model or grinding for that Kaggle competition prize pool, it can be hard to leave your models running in peace. Learn how to use Twilio’s API to notify you during your model training.

(是也乎:

叕一个想和自己聊的短信游戏...

)

Synthetic data is artificially annotated information that is generated by computer algorithms or simulations, commonly used as an alternative to real-world data. Learn where it can be useful and how it helps train your machine learning algorithms.

(是也乎:

从现实世界收集数据总是有成本的, 那么根据真实数据合成出肉来一样有营养的...吧?

)

Python 3.11 will be released in October 2022. In this tutorial, you’ll install the latest alpha release of Python 3.11 in order to preview task and exception groups and learn about how they can improve your asynchronous programming in Python.

(是也乎:

Py3.11

终于追上热点了, 以往 RealPython 都是抄冷饭...

)

This article will show you the easiest way to create an interactive dashboard in Python from any Pandas DataFrame. If you already know some Pandas, you can almost immediately use hvPlot .interactive and turn your data into a dashboard.

(是也乎:

hvPlot

俺说怎么这么眼熟...是对 Bokeh 的可用化...

)

Zapier is a no-code tool that takes input from a wide variety of web applications and connects their output to other applications. This article walks you through what you need to do to integrate Zapier with your Django project.

(是也乎:

Zapier 就是 Yahoo! 当年的 Pipes, 或是 PaaS 版本的 IFTTT, 类似的还有 Microsoft Flow/Automate.io/Workflow/Huginn/...

其实, 这种 PipePaaS 成立的前提是有足够多的专用服务, 以及对应服务有足够开放/稳定的接口...

)

This tutorial shows you how to use Python and Selenium Grid to build a parallel web scraper. By packaging it up in Docker and executing it in a swarm, you can scrape all the things!

Bas’s top 10 VSCode extensions for Python, including tools for indentation management, comments, tests, type hints, docstrings, and more.

(是也乎:

VScode 正式替代 Vim 了嘛? 毕竟, 即便在 linux 也可以通过 VScode srv. 回到桌面来嗯哼...

反正除了 M$ 那个, 其它都可以安装... 最讨厌 coding 时, 各种提醒了...

)

Fifteen code patterns that are problematic in Python and what alternatives to use instead.

(是也乎:

实例讲解, 越来越 Pythonic 的代码

)


好物/妙品/...

Interesting Projects, Tools and Libraries, Projects & Code

(是也乎:

memray

有认真设计 VI 的项目, 一般都是想作大的, 其实, Py 开发效率高, 也有越来越多项目增长起来了, 有对应优化工具, 值得关注的...

)

(是也乎:

真万物可游戏化, 当年 SQL 的推广可没这种游戏....

)

(是也乎:

dunk

看起来很美, 就是太过早期

Slame Dunk <- 这个梗儿用的好...

)

(是也乎:

pypyr

就象 Ansible , 只是专注 Py 执行, 优先本地嗯哼...

混合 cms+py 简直了..

)


📆🐍 活动/大会

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

(是也乎:

来了来了, 每年都有神仙项目发布...

)


DAMA

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

ACM-O

(是也乎:

谈崩了, 之前通过 ACM 会员可以每年 $25 享受 O'REILLY 在线图书馆服务...现在没了

)


PS:

PPS:

不觉中蟒周刊快译已经到了第10个年头

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

问为什么:

[皱眉]每周新闻资讯 怎么能错过 
看看有什么新东西 
当有新的发现时:
    what f**k 还能这样玩? 还有这东西?
    每周开彩蛋[吃瓜]

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


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

投稿/反馈邮箱:

askdama@googlegroups.com

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


ZoomQuiet/大妈

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

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

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


Comments


大妈的多重宇宙 - YouTube

全新自媒体系列...科学幻想,读书,说故事...
点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

订阅 substack 体验古早写作:
Zoom.Quiet’s Chaos42 | Substack


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


蟒营®编程思维提高班Python版

**2021.01.11** 因大妈再次创业暂停定期开设, 转换为预约触发:
  • + 任何问题, 随时邮件提问可也:
    askdama@googlegroups.com
-->