Issue 427

机器狗已在公开发售,支持用 Python 对其编程… 原文: PyCoder’s Weekly - Issue #427 200701 Zoom.Quiet(大妈) 用时 42 分钟 完成快译 200701 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. PEP 622: 结构模式匹配 PYTHON.ORG This PEP proposes adding pattern matching—a sort of enhanced switch statement—to the Python language. Read the PEP at the link above and follow the discussion on Reddit. (是也乎: def is_tuple(node: Node) -> bool: match node: case Node(children=[LParen(), RParen()]): return True case Node(children=[Leaf(value="("), Node(), Leaf(value=")")]): return True case _: return False 这非常 Elixir 了. ) ...

2020-07-01 · 4 min · 1863 words · ZoomQuiet

Issue 426

DjangoCon US 2020 取消了 原文: PyCoder’s Weekly - Issue #426 200624 Zoom.Quiet(大妈) 用时 42 分钟 完成快译 200624 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. 动手线性编程: 用 Python 进行优化 REAL PYTHON In this tutorial, you’ll learn about implementing optimization in Python with linear programming libraries. Linear programming is one of the fundamental mathematical optimization techniques. You’ll use SciPy and PuLP to solve linear programming problems. (是也乎: 线性规划, 经典的最优解区域寻定方法, 当然, 这得在具体问题场景中才有意义. ) OpenSafely: 用 Python/SQL和Docker 理解冠状病毒健康数据 JO BEST Django and Payton developers teamed up with clinicians and researchers to release a new analytics platform called OpenSafely that allows researchers to analyze NHS health records from over 24 million people In the UK. With strict safety and privacy standards, OpenSafely may help redefine how medical data is analyzed and shared. PEP 618 已为 Python 3.10 接受:向 zip() 添加可选长度检查 PYTHON.ORG PEP 618, which adds a new strict parameter to the built-in zip() function that optionally enforces same-length iterables, has been accepted for Python 3.10. Read the acceptance letter here and some interesting discussion about the PEP on Reddit. Pickle 的九个缺点 NED BATCHELDER “Python’s pickle module is a very convenient way to serialize and de-serialize objects. It needs no schema, and can handle arbitrary Python objects. But it has problems. This post briefly explains the problems.” (是也乎: 腌菜V5, 无论有多不健康, 好用才是王道. 当然, 有更好的推荐了: marshmallow(软糖推荐) , cattrs , protocol buffers , 等等 ) PyLadies 印度踏上征途 ANWESHA DAS On June 20th, 2020 PyLadies India held their first Meetup featuring a talk by CPython Core Contributor Mariatta Wijaya. Organizer Anwesha Das recounts her PyLadies journey and the steps the organization took to make the meetup a reality. (是也乎: 印度就是猛哪… ) 用 Let’s Encrypt 保护容器化 Django 应用程序的安全 TESTDRIVEN.IO • Shared by Jan Giacomelli Secure a containerized Django app running behind an HTTPS Nginx proxy with Let’s Encrypt SSL certificates. 在为 pandas 贡献时学到的高级pytest技术 MARTIN WINKEL Contributing to open-source projects is a great way to learn new techniques and level up your skills. Martin Winkel shares five advanced pytest techniques he learned while contributing to the pandas project. (是也乎: 每一个高速发展的大型开源项目中, 测试部分, 都是精巧的艺术品. ) NumPy 1.19.0 现已可用 NUMPY.ORG Version 1.19.0 drops support for Python 3.5 and below, including Python 2. (是也乎: Pandas 真正的内核以及英雄… ) 2020 年 Python 软件基金会董事会选举结果 PYTHON SOFTWARE FOUNDATION DjangoCon US 2020 取消了 DJANGO SOFTWARE FOUNDATION 讨论 Discussions ...

2020-06-24 · 5 min · 2343 words · ZoomQuiet

Issue 425

令机器学习投入生产 原文: PyCoder’s Weekly - Issue #425 200617 Zoom.Quiet(大妈) 用时 42 分钟 完成快译 200617 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. 令机器学习投入生产 VICKI BOYKIS Millions of web apps get deployed to production every day. But machine learning models aren’t web apps. And very few people are talking about deployment. Learn how tools like Streamlit can help take the edge off deploying your machine learning models. Python 生成器介绍 REAL PYTHON course In this step-by-step course, you’ll learn about generators and yielding in Python. You’ll create generator functions and generator expressions using multiple Python yield statements. You’ll also learn how to build data pipelines that take advantage of these Pythonic tools. (是也乎: ) 皮尤研究中心的 Python 库 PATRICK VAN KESSEL The Pew Research Center’s Data Labs team has open sources two Python libraries for wrangling files and cleaning up text documents. (是也乎: 目测, 这个研究库, 马上将被和谐. ) 异步 Python 并不快 CAL PATERSON Performance optimization is a tricky subject and silver bullets are rare. This article shines a light on some of the common misconceptions around async Python, like “async is always faster.” Related discussion on Hacker News. (是也乎: 初学者困境… 就是非常容易被这种看似公允的测试说明相信一个断言. 真实场景中: 1、异步 web 服务器不可使用 reverse proxy,因为 async server 性能高于 reverse proxy。瓶颈位置在 reverse proxy 和 wsgi 层而非 web server。使用 reverse proxy 是因为多线程 context 切换成本高,开不了很多,所以需要一个能无限开 context 的异步服务器(nginx)挡在前面。而本身异步的服务器不需要。 2、异步 web server 不可使用 connection pool 和消息队列,因为无论是协程还是纯单线程异步,协程数和连接数都用不完。由于不存在多线程或者多进程的 context 切换成本,导致只能起有限的线程数,所以需要连接池。异步的连接数用不完,所以不需要连接池,否则会成为瓶颈。 3、异步服务器在并发数超过 1000 时才会明显体现出来,sync 服务器即使在使用 reverse proxy 的情况下由于中间的代理损耗也很难处理 1000 以上的并发。我在对异步服务器做性能测试的时候,是测试程序先挺不住,真实测试异步服务器的性能的技术含量不低,初学者做不到。 这篇作品槽点太多,先说以上几点。一个个讲过来,要打一天的字。 <– 摘录隔壁群中对此文章的部分观点. 简单说, 对异步和协程的理解, 文章测试出发点就有问题. ) ...

2020-06-17 · 5 min · 2361 words · ZoomQuiet

Issue 424

Flask 结合 Vue 原文: PyCoder’s Weekly - Issue #424 200610 Zoom.Quiet(大妈) 用时 42 分钟 完成快译 200610 Zoom.Quiet(大妈) 用时 37 分钟 完成格式转抄. Python 中 Web 爬虫: 工具/技术和合法性 REAL PYTHON podcast Do you want to get started with web scraping using Python? Are you concerned about the potential legal implications? What are the tools required and what are some of the best practices? This week Kimberly Fessel is a guest on the Real Python Podcast to discuss her excellent tutorial created for PyCon 2020 online titled “It’s Officially Legal so Let’s Scrape the Web.” (是也乎: 从 西部世界 中才知道 host 的另外含义. ) 用 Pydantic 进行 Pedantic 配置管理 REDOWAN NAFI • Shared by Redowan Delowar Dealing with multiple configuration files for a Python application can be stressful. Learn how to take the edge off with a custom workflow centered around the Pydantic library. 异步应该如何 NIKITA SOBOLEV • Shared by Nikita Sobolev opinion Sometimes synchronous and asynchronous code can look very similar. The only difference might be the use of async and await keywords. In this opinion piece, Nikita Sobolev argues that the potential for repeated code is a design fault of Python’s asyncio framework, and describes a solution that allows synchronous Python to execute asynchronous code. 我们的 Python Monorepo DAN HIPSCHMAN Opendoor, a residential real-estate startup, has quite a few Python services. These services were spread across several git repositories, but Opendoor’s engineering team recently moved them all into a single monorepo. Learn about the challenges the team faced with many repositories and how they set-up their monorepo to solve their problems. (是也乎: 反正 Google 将 Monorepo 玩出花了, 大家就认为 Monorepo 一定香. 其实, 呵呵… ) 在 Python 展平列表的最快方法 CHRIS CONLAN Explore six different was to flatten a list of lists in Python and how their performance compares. The fastest of the six methods mentioned might surprise you! (是也乎: 其实吧, 一般撞不到这么邪的场景. ) 2020 年 Python 软件基金会董事会选举提名 PYTHON.ORG Ballots were sent out on June 8th. 讨论 Discussions ...

2020-06-10 · 4 min · 1704 words · ZoomQuiet