Python 3.10 中值得尝试的新特性...

原文: PyCoder's Weekly - Issue #493

pycoder

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

Explore some of the coolest and most useful features in Python 3.10. You’ll appreciate more user-friendly error messages, learn about how you can handle complicated data structures with structural pattern matching, and explore new enhancements to Python’s type system.

(是也乎:

Cool

改进了 error message, 加强了模式匹配, 拓展了 pattern, 比如:

def greet(name):
    match name:
        case "Guido":
            print("Hi, Guido!")
        case _:
            print("Howdy, stranger!")

嗯哼, Elixir 们的语法;

def fizzbuzz(number):
    mod_3 = number % 3
    mod_5 = number % 5

    match (mod_3, mod_5):
        case (0, 0):
            return "fizzbuzz"
        case (0, _):
            return "fizz"
        case (_, 0):
            return "buzz"
        case _:
            return str(number)

)

Data Elixir is an email newsletter that keeps you on top of the tools and trends in Data Science. Covers machine learning, data visualization, analytics, and strategy. Curated weekly with top picks from around the web →

(是也乎:

ELIXIR

串行了... 继 go+ 立志取代 R/Python 作为数据科学主力语言后, Elixir 也开始进入这一领域...

)

A recording of the Python 3.10 Release Stream with Pablo Galindo, CPython Core Developer and Python 3.10 Release Manager, and Leon Sandøy.

With “Zero-cost” exceptions the cost of try statements is almost eliminated when no exception is raised.


探讨/吐糟

Discussions

Static type-checkers such as Mypy have grown increasingly popular in recent years in the Python community, yet it’s surprisingly difficult to write a type hint that will accept any number. This answer on Stack Overflow digs into why.

Why explicit is better than implicit, or in Martin Fowler’s words: “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”

(是也乎:

只有 NB 的程序猿才写得出人类可以理解的代码.

)


文章/教程/嗯哼

Articles, Tutorials and Talks

Have you wanted to create a Python application that goes further than a command-line interface? You would like it to have a friendly interface but don’t want to make a GUI (Graphical User Interface) or web application. Maybe a TUI (Text User Interface)would be a perfect fit for the project. This week on the show, it’s Will McGugan talking about his projects Textual and Rich.

(是也乎:

TUI

对于日常生活在 CLI 中的, TUI 才是王道哪...

TUI )

How to work with multiple queues in Celery, when you need it and how to set it up. The tutorial includes file processing and DNS lookups for domains of email addresses. Also, docker-compose.yml is covered for local development.

In this step-by-step project, you’ll learn about hosting Django projects in the cloud using Heroku, a platform-as-a-service (PaaS) provider used by many startups and developers.

(是也乎:

Heroku ? 远古的呼唤...

)

How to set up VSCode to deal nicely with proportional fonts and set up automated code formatting that leads to a visually pleasing result.

(是也乎:

Yapf

等等, 难道不是必须等宽嘛?

)

An article about the importance of having a consistent Python coding style and tools that can help you achieve this goal.

Learn about some of the most popular Python editors in this tutorial. Includes info on PyCharm, WingIDE, VSCode, and IDLE

(是也乎:

其实, 还是 Leo 最赛高, 如果真的理解并习惯 文学化编辑...

)

A primer on using PostgreSQL to more efficiently perform your data evaluation tasks done in Excel, R, or Python.

A look at several best practices to make your Dockerfiles and images cleaner, leaner, and more secure.

(是也乎:

Docker 作为缝合怪, 也是有专有使用技巧的, 得熟练, 然后就自然不过脑了...

)

This guide shows you how to create a nice-looking PDF flyer in Python using the borb PDF library.

How to write a CPython Extension in 100% assembly.

(是也乎:

Assembly

)


好物/妙品/...

Interesting Projects, Tools and Libraries, Projects & Code

(是也乎:

MagInkCal

等等,这么大电子墨水屏就不少銭了哈... Raspberry Pi Zero 的实用化作品.

)

(是也乎:

SQL 标准其实也很复杂, 静态分享工具, 果断有Python 一份儿

)

(是也乎:

pyan

叕一个基于 Graphviz 的图形脚本工具, 用 Python 完成说明, 自动生成优化后的 .dot 脚本, 然后使用 Graphviz 标准工具生成目标图形, 简直就是 Python 作为胶水语言的天然用法...

)


📆🐍 活动/大会

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

⋅ PyCon ZA 2021 October 7 to October 9, 2021

⋅ Canberra Python Meetup October 7, 2021


DAMA

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

(是也乎:

独创 logging + debug 模块

)

(是也乎:

老司机开新坑, 时隔10年, 沈游侠再次开声, 值得关注:

Bilibili

)


PS:

PPS:

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

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

问为什么:

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

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


好文笔,感叹号年度配额: 2/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
-->