Issue 383

原文: PyCoder’s Weekly - Issue #383 您的 CPython 源代码指南 REAL PYTHON In this detailed Python tutorial, you’ll explore the CPython source code. By following this step-by-step walkthrough, you’ll take a deep dive into how the CPython compiler works and how your Python code gets executed. (是也乎: 结合多年前的源代码鉴赏就知道, 源代码, 想看一定能看懂, 就好比, 建筑师通过复杂计算/设计/思考/施工, 完成的建筑, 虽然无法简单的透视一切, 但是, 依然可以通过各种行为, 快速理解真正的设计点是什么… ) 函式重构为多个退出点 MARTIJN FAASSEN “It’s sometimes claimed that not only should a function have a single entry point, but that it should also have a single exit. One could argue such from sense of mathematical purity. But unless you work in a programming language that combines mathematical purity with convenience [… ] that point seems moot to me.” (是也乎: 良心经验, 多退出点, 也是俺写代码时, 经常干的事儿, 但是, 从没完备思考过, 为什么, 以及有什么问题和好处… ) Python 3 自动更新 PY3READINESS.ORG This is an automated Python 3 support table for the most popular packages. 360 out of the 360 most downloaded packages on PyPI now support Python 3. (是也乎: 不是俺敏感哪, 这批包和 360 真的没什么关联嘛? ) 到时候摆脱 Python 2 NCSC.GOV.UK “Don’t constrict yourself, Python 2 slithers off into the sunset in 2020.” (是也乎: 放心, 有的场景中, Python 1.* 都在用呢 ) Onelinerizer: 将Python 代码重写为单行程序 ONELINERIZER.COM Fun! (是也乎: 说是任何程序哈… ) 讨论 Discussions ...

2019-08-28 · 4 min · 1833 words · ZoomQuiet

Issue 382

原文: PyCoder’s Weekly - Issue #382 有效的 Python 环境: 构造自己的家 REAL PYTHON This guide will walk you through the decisions you need to make when customizing your development environment for working with Python: shells, terminal emulators, version management (pyenv), virtual environments & pipenv, package management, and more. (是也乎: pyenv 是正确的开始. ) 规模 Python 静态分析: Instagram 版本 BENJAMIN WOODRUFF (INSTAGRAM) Instagram’s back-end is a massive Django app with several million lines of code. This post is about how they’ve used linting and automated refactoring to help manage the scale of their Python codebase. (是也乎: 这之前 google 已经完成更加大规模静态自动化分析… 只是, 故事主人没怎么说… ) 为 Python 编写自定义 profilers ITAMAR TURNER-TRAURING In this article you’ll learn how to write custom profilers, and in particular profilers that will help you pinpoint the places in your code where it just sits there waiting. Python Web 框架概述 STXNEXT.COM Django, Flask, Pyramid, and many, many others—get an overview of what’s available so you can choose the right Python framework for your web development project. 设计持续构建系统: 用 Sanic 处理 Webhooks CHRISTIAN MEDINA • Shared by Cristian Medina How to use Python and Sanic to handle webhook events from GitHub in continuous build systems. PyCon US 2020 网站已上线 PYCON.ORG PyCon 2020 takes place April 15–23, 2020 in Pittsburgh, PA. (是也乎: 加油 PyCon2020China , 目测咱们的 11月能上线就是巨大的进步… 以往都是下半年了,才上线当年的… ) 讨论 Discussions ...

2019-08-21 · 5 min · 2235 words · ZoomQuiet

Issue 381

原文: PyCoder’s Weekly - Issue #381 用 Python 进行传统人脸检测 REAL PYTHON video In this course on face detection with Python, you’ll learn about a historically important algorithm for object detection that can be successfully applied to finding the location of a human face within an image. (是也乎: 当然, 现在 BAT 都有自己云 AI 了, 直接调用, 就不用本地生撸了… ) Python 中的三种反转控制技术 DAVID SEDDON Inversion of Control, in which code delegates control using plugins, is a powerful way of modularising software. It may sound complicated, but it can be achieved in Python with very little work. This article examines three different techniques for handling IOC in Python. (是也乎: IoC ~ 委托控制插入… 模块化软件的有效手段, 其实就是插件技术, 只是在代码层面上的… 大约是: 依赖注入,注册,猴补丁, 这几个思路. ) NumPy 1.17.0 不再支持 Python 2 MAIL-ARCHIVE.COM “The 1.17.0 release contains a number of new features that should substantially improve its performance and usefulness. The Python versions supported are 3.5-3.7, note that Python 2.7 has been dropped.” (是也乎: 爱过… ) print() 函式深挖 (17,000 字指南) REAL PYTHON Learn all there is to know about the print() function in Python and discover some of its lesser-known features. Avoid common mistakes, take your “hello world” to the next level, and know when to use a better alternative. (是也乎: 深挖灵魂40层, 当问打印合理无. ) Python 工具环境概述 ADITHYA BALAJI An opinionated guide to tooling in Python covering pyenv, poetry, black, flake8, isort, pre-commit, pytest, coverage, tox, Azure Pipelines, sphinx, and readthedocs. (是也乎: 每年这种文章都得更新一下, 非常值得对比检验自己武器库是否合理的: Python 工具全景图 ) 通过从头开始编写异步 Web 框架来剖析其工作原理 OLEH KUCHUK (是也乎: 叕一则从0 开始, 手撸框架, 只为了嗯哼明白到底什么是重要的 ) 讨论 Discussions ...

2019-08-14 · 5 min · 2360 words · ZoomQuiet

Issue 380

原文: PyCoder’s Weekly - Issue #380 在 Django Admin 中管理用户应该了解的 REAL PYTHON Learn what you need to know to manage users in Django admin. Out of the box, Django admin doesn’t enforce special restrictions on the user admin. This can lead to dangerous scenarios that might compromise your system. (是也乎: 当年的时尚, 今天就变成黑魔法了… ) 为什么你的 Mock 不起作用 NED BATCHELDER “Mocking is a powerful technique for isolating tests from undesired interactions among components. But often people find their mock isn’t taking effect, and it’s not clear why. Hopefully this explanation will clear things up.” (是也乎: 所以, 还是 Docker 中给真东西测试吧 ) Django 安全版本发布: 2.2.4, 2.1.11 and 1.11.23 DJANGOPROJECT.COM Addresses DoS possibilities in django.utils.text.Truncator, strip_tags(), django.utils.encoding.uri_to_iri(), and a potential SQL injection issue in JSONField/HStoreField. (是也乎: 三连发…可见 Django 基金会是真赚銭的… ) PySpark 大数据处理的第一步 REAL PYTHON Take your first steps with Spark, PySpark, and Big Data processing concepts using intermediate Python concepts. 用 Fakes 以及 Factories 改进 Django 测试 MARTIN ANGELOV This blog post is an introduction into unit testing in Django. It offers an explanation on what are faker and factories and code examples illustrating them. Python 中的内存管理 ARTEM GOLUBIN This article describes memory management in CPython 3.6 and how it uses a pool allocator called PyMalloc to speed-up memory operations and reduce fragmentation. (是也乎: 随着 Python 越来越 C++ 化, 内存问题也必然回到程序猿眼前… ) PEP 589 – TypedDict: 带有一组固定键的字典类型提示 PYTHON.ORG 讨论 Discussions ...

2019-08-07 · 4 min · 1924 words · ZoomQuiet