值得收藏的22个最常用 Python 模块

原文: PyCoder's Weekly - Issue #406

PyCoder

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

"Now that LinkedIn engineering has fully embraced Python 3, we no longer have to worry about supporting Python 2 and have seen our support loads decrease. We can now depend on the latest open source libraries and tools, and free ourselves from the constrictions of having to write bilingual Python."

(是也乎:

LinkedIn 的故事教导我们...

)

In this quick and practical tutorial, you'll learn when to use the Python is, is not, == and != operators. You'll see what these comparison operators do under the hood, dive into some quirks of object identity and interning, and define a custom class.

(是也乎:

Comparing

好可爱的插图, 油号不匹配真的会出大事儿的

)

"Software engineering principles, from Robert C. Martin's book Clean Code, adapted for Python. This is not a style guide. It's a guide to producing readable, reusable, and refactorable software in Python."

"As a starting point, I took a list of the most downloaded Python packages on PyPI over the past 365 days. Let's dive in and find out what they do, how they're related, and why they rank so high!"

(是也乎:

最具价值的模块, 多数没收录在内建中:

Urllib3; Six(2->3 自动兼容); botocore, boto3, s3transfer, awscli (云厂商专用模块);

Pip;Python-dateutil;Requests; S3transfer;Certifi(SSL 支持模块我); Idna(民族文化); PyYAML(越来越常用的);

Pyasn1;Docutils;Chardet;

RSA;

Jmespath(叕一个 JSON 支持);

Setuptools;Pytz;Futures;

Colorama;Simplejson;

都是百万级别的下载量... )

"Everything I'm currently doing for testing my personal [Python] projects, and the reasoning for why I do things the way I do." Interesting read if you're looking to optimize your testing setup.

(是也乎:

私人项目才玩的起高科技哪, 越是大项目, 越应该选择无聊的技术桟.

)

Fixes CVE-2020-7471: Potential SQL injection via StringAgg(delimiter)

(是也乎:

Django 现在分裂为几个大产品线,是否正确, 还有待市场检验.

)

(是也乎:

等了10多年的 1.0 版本

)

讨论

Discussions

(是也乎:

对历史兼容何时变的不是第一要求了?

)

文章,教程和嗯哼

Articles, Tutorials and Talks

"When you're choosing a base image for your Docker image, Alpine Linux is often recommended. [... ] But if you're using Python, Alpine Linux will quite often: Make your builds much slower. Make your images bigger. Waste your time." Related discussion on Hacker News.

(是也乎:

等等,这是 Alpine 的特性嘛? 只针对 Python?

)

Learn how to work with Python's set data type. You'll see how to define set objects in Python and discover the operations that they support. By the end of this course, you'll have a good feel for when a set is an appropriate choice in your own programs.

(是也乎:

真蟒, 在有了流量后, 开始大力积累收费内容了...

)

In this tutorial, you'll learn how to use a Flask Blueprint to help you structure your application by grouping its functionality into reusable components. You'll learn what Blueprints are, how they work, and how you can use them to organize your code.

(是也乎:

Blueprint

兰图是 Flask 对应用工程的思考成果, 可惜, 整个儿 Flask 的生产力被依赖的上游模块拖乱了, 导致 Django 赢得了一切.

)

"Dependency injection is a controversial topic. There are known problems, hacks, and even whole methodologies on how to work with DI frameworks. It is not the case when using a functional approach."

Tips about avoiding known gotchas when configuring uWSGI to host services at scale — while still providing a base level of defensiveness and high reliability.

(是也乎:

uWSGI 不错, 因为不可安装在 windows 中

)

"Pure python implementation of the random search optimization algorithm as an alternative to the standard gradient descent, given a very silly example."

(是也乎:

在 世界重启 那书中, 广泛的讨论了人类技术的可靠延续 ;-) )

(是也乎:

不是 王珢, 是另外一位在校学生, 之前推荐过这篇文章.

)

(是也乎:

很久没见 PyPy 相关的文章了...

)

(是也乎:

其实, Anaconda 已经作的很好了

)

好物

Interesting Projects, Tools and Libraries, Projects & Code

(是也乎:

atom_overview

叕一个追踪库, 只是基于 PyTorch, 不知道实时性如何

)

(是也乎:

for humans 是个好目标, 只是作到的非常少

)

(是也乎:

叕一种嵌入 C 代码的形式

)

(是也乎:

超越推导

)

(是也乎:

H 就是 handle, 为 C 提供更好的 Python 接口, 这个思路很靠谱哪.

)

(是也乎:

Flake8 终于开始关注 Pandas 了

)

(是也乎:

经过400多期, 9年的积累, 现在 pycoders 周刊,越来越多主动分享的消息了

)

(是也乎:

gif

叕一个 gif 动画制造工具, 嗯哼, 这 logo 非常亲切了

tornado

使用也非常简单:

import gif
from matplotlib import pyplot as plt

@gif.frame
def plot(x, y):
    plt.figure(figsize=(5, 3), dpi=100)
    plt.scatter(x, y)
    plt.xlim((0, 100))
    plt.ylim((0, 100))

正常定义好一帧 plt 图片, 然后指定范围自动化生成就好, 比如:

from random import randint

frames = []
for _ in range(50):
    x = [randint(0, 100) for _ in range(10)]
    y = [randint(0, 100) for _ in range(10)]
    frame = plot(x, y)
    frames.append(frame)

)

(是也乎:

基于 sympy

)

📆🐍 活动/大会

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

(是也乎:

Pythonner 才是正式的 Python 开发者族群名哪.

)

DAMA

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

(( ̄▽ ̄):

第五期已经开始报名:

20.2.20 报名截止
20.3.1  正式开课
20.4.12 按时结束

)

(是也乎:

高速完成构建/发布/传播, 以及社区联合的开源项目, 数据不公开, 那就由人来采集再公开.

)

是也乎

NN 3914


Comments



精品小班 蟒营™Python入门班 第9期 报名安排

  • 开始报名: 2020.5.31
  • 报名截止: 2020.6.21
  • 正式开课: 2020.6.28
  • 课程结束: 2020.9.06
101camp9py

蟒营™式 原创课程

伴你重享学习乐趣

py.101.camp

Reactivate Joy by Self-teching with You


任何问题可先进入知识星球(免费)咨询:
FAQ

关注公众号, 持续获得相关各种咨询:
mainium


追问

任何问题, 随时邮件提问可也:
askdama@googlegroups.com