对数据科学家有用的 Python 装饰器

原文: PyCoder's Weekly - Issue #527

pycoder

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

Ever use list() or enumerate()? Think of them as functions? They’re not, they’re classes. Sometimes we call classes functions in Python. Why? And what’s a “callable”?

In this Code Conversation video course, you’ll take a deep dive into how scopes and closures work in Python. To do this, you’ll use a debugger to walk through some sample code, and then you’ll take a peek under the hood to see how Python holds variables internally.

(是也乎:

COURSE

是的, 套娃, 幸好 Python 严密的用缩进进行了可视化先...

)

The * is for more than multiplication, it is also the basis for the two deconstruction operators: * and **. Learn the ins-and-outs of using *args, **kwargs, deconstruction, and forcing keyword-arguments-only in functions.

(是也乎:

全新 Hijacked 姿势...

)


探讨/吐糟

Discussions

Marton Trencseni posted Useful Python decorators for Data Scientists, a follow-up to the article included in Issue #525. It got posted on Hacker News and strong opinions ensued. Read the article, then weigh in.

(是也乎:

Bytepawn - Marton Trencseni – Useful Python decorators for Data Scientists

数据科学常用修饰符函式

一键追加实用观察

)

Discussion based on the previously linked article Python Standard Library Changes in Recent Years.

(是也乎:

变化太多, 基本只用基本数据结构, 其它都用第三方模块了... )


文章/教程/嗯哼

Articles, Tutorials and Talks

Scripts often need either configuration or data to proceed and for many situations this can be passed in on the command line. The standard library argparse helps you parse arguments, add help info, and even alias your commands.

(是也乎:

推荐还是用类似 invoke 之类高度封装后的 CLI 开发框架

)

There are lots of choices when developing animated plots, many of which have a steep learning curve. Learn how to create animated GIFs through matplotlib and ImageIO to bash something out quickly.

You probably know about runserver, migrate and shell, but there are lots more Django management commands. Learn about diffsettings, sendtestemail, inspectdb, and showmigrations.

(是也乎:

为什么 鲜为人知 ?

)

Visualizing regular expressions can help you understand how they work and what a particular expression accomplishes. Read on to learn how to use Graphviz to better understand your regex.

(是也乎:

aydinschwa/Regex-Engine: Educational, animated regular expression engine

亮了, 用 Python 分析清楚正则表达式的匹配顺序, 然后逐步用 Graphviz 可视化, 最后拼为动画

demo

看起来更加乱了...

)

Step-by-step instructions on creating a web application with a React front-end and the Django Rest Framework as a back-end and all tied together with Docker for distribution.

(是也乎:

虽然听起来 Low , 但是, CRUD 的确是绝大多数系统的核心使命, 真想作到也不容易...

)

A quick listing of what features were added in which version of Python, going back to Python 2.1 and including links to corresponding PEPs.

(是也乎:

Python 3 以来关键版本的关键使命规划...

)

Learn how to make your classes act like native data types through the implementation of double-underscore magic methods.

A look at one or two ways to make life easier when working with Python regular expressions.


好物/妙品/...

Interesting Projects, Tools and Libraries, Projects & Code

(是也乎:

IBM 作品

)

(是也乎:

为了避开 PEP517 而构建

)

(是也乎:

是的, 越来越多开源工程迁移到 GitLab 上来了

)


📆🐍 活动/大会

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


DAMA

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

ACM-O

(是也乎:

谈崩了, 之前通过 ACM 会员可以每年 $25 享受 O'REILLY 在线图书馆服务...现在没了

)


PS:

PPS:

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

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

问为什么:

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

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


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

投稿/反馈邮箱:

askdama@googlegroups.com

(邮件列表地址, 当成正常邮件发送邮件就好, 不用注册, 不用翻越...)


ZoomQuiet/大妈

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

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

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


Comments



自怼圈/年度番新

DU22.8
关于 ~ DebugUself with DAMA ;-)
点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

订阅 substack 体验古早写作:


关注公众号, 持续获得相关各种嗯哼:
zoomquiet


蟒营®编程思维提高班Python版

**2021.01.11** 因大妈再次创业暂停定期开设, 转换为预约触发:
  • + 扫描预约入群, 学员每满 42 人即启动新一期训练营 ;-)
  • 101camp22.7
  • + 任何问题, 随时邮件提问可也:
    askdama@googlegroups.com
-->