Python 编程令俺数学长进了...

原文: PyCoder's Weekly - Issue #415

PyCoder

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

Discover how to use Arduino microcontrollers with Python to develop your own electronic projects. You’ll learn how to set up circuits and write applications with the Firmata protocol. You’ll control Arduino inputs and outputs and integrate the board with higher-level apps.

(是也乎:

其实有更加友好的 MicroPython - Python for microcontrollers 生态哪...

)

Python’s multiprocessing module abstracts away a lot of the overhead involved in writing multiprocessing code in Python. But while it might be “easy” to implement multiprocessing in Python, it’s not always easy to do multiprocessing well. In this article, Pamela McA’Nulty shares five tips to help you write better multiprocessing code.

(是也乎:

相比多线程, 多进程已经少很多坑了..

但是, 那也比不上 Pyhton 自己不管任何 多XX , 运行时管理丢给系统监管就好.

)

The Packaging Working Group of the Python Software Foundation is launching an all-new sponsorship program to sustain and improve Python’s packaging ecosystem. Funds raised through this program will go directly towards improving the tools that your company uses every day and sustaining the continued operation of the Python Package Index.

“I have seen setuptools users use pyproject.toml because they were ‘told to by ‘ without knowing the entire point behind the file. And so I decided to write this blog post to try and explain to setuptools users why pyproject.toml exists and what it does as it’s the future of packaging in the Python ecosystem.”

“In this post, I’ll try to explain why I find most config formats frustrating to use and suggest that using a real programming language (i.e. general purpose one, like Python) is often a feasible and more pleasant alternative for writing configs.”

(是也乎:

配置和代码的边界太难以嗯哼了.. 俺一直使用 .py 当配置文件使用, 直到交付其它人用时, 才发现这太容易引入无法预料的人为 bug 了...

然后, 开始各种专用配置文件的尝试...

然后... 当然又回到 .py 了哈.

)

The PSF Fellow Members for Q1 2020 have been announced. Congratulations to all of the new fellows!

“Python 2.7.18 will be the last release of the Python 2.7 series, and thus Python 2.” (It’s not dead, it’s resting!)

讨论

Discussions

(是也乎:

广告. )

The string module has a string called punctuation containing several different punctuation characters from the ASCII character set. But not all possible punctuation characters are contained in string.punctuation, such as fancy quotes. What’s the best way to check if any Unicode character is punctuation?

math.ceil rounds a number to the next highest integer, but how could you round a number to the next highest power of 10 in pure Python?

(是也乎:

math.ceil 只能对 10进制整数作用,

)

文章,教程和嗯哼

Articles, Tutorials and Talks

“In finance, computation efficiency can be directly converted to trading profits sometimes. Quants are facing the challenges of trading off research efficiency with computation efficiency. Using Python can produce succinct research codes, which improves research efficiency. However, vanilla Python code is known to be slow and not suitable for production. In this post, I explore how to use Python GPU libraries to achieve the state-of-the-art performance in the domain of exotic option pricing.”

(是也乎:

简单说, 语言性能问题硬件来解决.

)

Building up a long string by repeatedly concatenating to the end of the “same” string has been considered an anti-Pattern in Python for quite some time. Since strings are immutable, each concatenation should create a new string and therefore incur a performance penalty. Learn how Python 3 optimizes this penalty away, as well as other thoughts on the topic of string concatenation, in this briefing of a recent discussion on the python-ideas mailing list.

“Python has been around for a long time. In that time, deep in the corners of its system, it has accumulated some almost forgotten templating languages that are well worth poking at. Like cute koalas on top of a eucalyptus tree, happy in their ecological niche, and sometimes as dangerous to work with, these are the templating languages few have heard of—and even fewer should use.”

(是也乎:

俺总是嗯哼的:

忘记的就是不重要的
不知道就是不必要的

提及了 Quixote 这是豆瓣的灵魂哪... 以及: 寻找更好的模板系统记 - 魏中华 - 网易博客

这个悬案一直没解决呢...

)

In this episode, Christopher interviews Brett Slatkin about the 2nd edition of his book Effective Python. Brett talks about the revisions he made for the book, and updating it for the newest versions of Python 3. Brett also discusses working on Google App Engine, and what it’s like to develop and maintain Python applications at Google Scale, and working with Guido van Rossum.

podcast

“Unpacking in Python refers to an operation that consists of assigning an iterable of values to a tuple (or list) of variables in a single assignment statement. In this tutorial, [you’ll] learn what iterable unpacking is and how [you] can take advantage of this Python feature to make [your] code more readable, maintainable, and Pythonic.”

(( ̄▽ ̄)3:

解包是比打包更加优雅的挑战

)

In this article, you’ll learn what linked lists are and when to use them, such as when you want to implement queues, stacks, or graphs. You’ll also learn how to use collections.deque to improve the performance of your linked lists and how to implement linked lists in your own projects.

(是也乎:

Linked

没有从 0 开始, 差评.

)

“Just because a programming pattern or convention becomes popular doesn’t always mean that it’s a good idea. This talk digs into the consensus that the Python community has built around what constitutes ‘Pythonic’ code, with a focus on cases where the conventional wisdom may be wrong.”

(是也乎:

Pythonic 就是最好的模型...其它的都有走味儿的危险.

)

“I wrote this blog post because I succeeded in applying the Clean Architecture in two Python projects – both of them reached production and are still being used and developed. This article contains python-specific techniques and tools helpful in embracing the Clean Architecture.”

(是也乎:

可测试的...这可能是 namming 之外, 最困难的一种设计目标了.

简单的说, 为了放屁,一定要事先在裤子上科学开洞.

)

Learn all about how to use InstaPy to create an Instagram bot that can increase your follower and like count with minimal effort on your end. Along the way, you’ll also learn about two tools that InstaPy uses under the hood: Selenium and the Page Object Pattern.

(是也乎:

InstaPy

是的, 得感激人家 ins. 一直以来的给力接口, 以及开源机制促的这么完备的模块...

)

Stuck in quarantine with a middle schooler? Daniel Lowengrub has put together a fun lesson plan that teaches a beginner how to program in Python with numerous examples and small projects, culminating in an implementation of Tic-Tac-Toe.

(是也乎:

中学生的 Python ... 简化版 LPTHW ;

可能最大的困难就是如何在拥有了 Laptop 后不打游戏/刷剧/... 而来编程.

)

“On this episode, I’ll exchange stories about working from home with Jayson Phillips. He’s been writing code and managing a team from his home office for years and has brought a ton of great tips to share with us all.”

When your Django application sends back a response with your user interface, templates are the tool you’ll use to produce that user interface. This article looks at what templates are and how to use them.

“Django comes with a lot of useful features. One of them is middleware. In this post I’ll give a short explanation how middleware works and how to start writing your own.”

This post looks at how to configure Celery to handle long-running tasks in a Django app.

(是也乎:

已经是第4篇相关文章了, 看来 Celery 和 Django 是强强联合的希望

)

好物

Interesting Projects, Tools and Libraries, Projects & Code

(是也乎:

matplotlib

matplotlib 虽然古老, 但是, 社区是活跃的

)

(是也乎:

车胎质量检验...

)

(是也乎:

叕一个配置文件内容解析器...

)

(是也乎:

那什么, SQLite2/3/4/... 人家就没打算包含这种特性哪.. 为什么一定触发?

)

(是也乎:

利用 HomeKit 传感器?

co2meter

看起来外国人很担心 CO2 含量...

)

(是也乎:

cliche

叕一个 CLI 工具框架, 装饰器配合 doc-string

)

📆🐍 活动/大会

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

(是也乎:

你说 zoom 的股票能不涨嘛?

)

(是也乎:

怪不得 Django 是老大呢...

)

DAMA

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

101camp7py 已开始报名(能开发票 ;-)

参考: 余晟以为 的推荐 关于在本公众号进行付费阅读的通知

PS:


NN 3977

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

投稿/反馈邮箱:

askdama@googlegroups.com

ZoomQuiet/大妈

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

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

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


Comments


大妈的多重宇宙 - YouTube

全新自媒体系列...科学幻想,读书,说故事...

任何问题

随时邮件提问可也:
askdama@googlegroups.com

-->