简单将GraphQL接口添加到DRF应用程序

原文: PyCoder's Weekly - Issue #511

pycoder

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

Learn about Python optional arguments and how to define functions with default values. You’ll also see how to create functions that accept any number of arguments using args and *kwargs.

(是也乎:

Optional

其实, 默认值本身也是一种漏洞...

)

How to seamlessly support typing.Protocol on Python versions older and newer than 3.8. At the same time.

(是也乎:

import sys

if sys.version_info >= (3, 10):
    from typing import ParamSpec
else:
    from typing_extensions import ParamSpec

这类补丁何时是个头?

)

Improving your game’s main loop for smoother gameplay that takes less battery power: “Now your players’ laptops run cool while playing, and the graphics don’t have ugly tearing artifacts any more!”

(是也乎:

)

JavaScript retains the top spot, Python keeps 2nd place gained in 2019 over Java, which holds in 3rd. Typescript continues 4th after racing up from 2017 from 10th to 4th in 2020. JavaScript + TypeScript seem to put that way ahead in terms of amount of code on GitHub.

(是也乎:

排名

top5 里有三个都是 微软 一家的...

人数

猜中国有多少?

)

In January 2022, Black came out of Beta, IPython 8.0 was released, PEP 665 was rejected, and last but not least, a fifteen-year-old bug was fixed. In this article, you’ll get the details on these important happenings in the world of Python.

(是也乎:

New

)

This release includes: smart selection, folding support, improvements to the Python interpreters list, improvements when using Anaconda.

(是也乎:

反正, 俺是关闭的

)

“We needed to tame some angry buildbots, but after a small fight, we won with just some scratches! Here you have a shiny new alpha release: Python 3.11.0a5.”


探讨/吐糟

Discussions

“I propose to deprecate the urllib module in Python 3.11. It would emit a DeprecationWarning which warn users, so users should consider better alternatives like urllib3 or httpx: well known modules, better maintained, more secure, support HTTP/2 (httpx), etc.”

(是也乎:

是时候了...很多是时候, 一般都不是时候

)

“People used to say all kinds of things about Python’s native IDLE editor, but lately it has become a viable alternative for me to other editors like Notepad++.”

(是也乎:

IDLE 和 Notepad++ 两大上古神器, 真的没想到一直在改进, 这都多少年了...

)


文章/教程/嗯哼

Articles, Tutorials and Talks

Would you like to experiment with analyzing or manipulating audio with Python? This week on the show, we have Braden Riggs from DolbyIO to discuss extracting audio features and Python libraries for reshaping audio. Braden shares techniques from his recent talk at PyData Global, “Unlocking More From Your Audio Data!”

(是也乎:

Audio

音频分析和图像分析基本一致, 比视频分析要弱一个级别

)

“We all spend a good chunk of our time debugging, sifting through logs, or reading tracebacks. Each of these can be difficult and time-consuming and in this article, we will focus on making the last one—dealing with tracebacks and exceptions—as easy and efficient as possible.”

(是也乎:

Beautiful

是否漂亮, 关键不在颜色, 而在真正按逻辑的给出陈述

)

“Function overloading is a common programming pattern which seems to be reserved to statically-typed, compiled languages. Yet there’s an easy way to implement it in Python with help of multimethods or, as it’s called in Python, Multiple Dispatch.”

“I’m writing this blog post in the hope that some people will be encouraged to test friendly/friendly-traceback with IPython/Jupyter and make suggestions as to how it could be even more useful.”

(是也乎:

没有对比就没有伤害, Friendly

通过追加的 what()/why()/where() 专用函式来丰富/合理化 traceback 的输出

其实, 真能作到的话, 反过来, 人工撰写 what/why/when/where 之类的要求, 也应该能生成对应正确代码了?

)

Learn how to find the length of built-in data types using len(), use len() with third-party data types, and provide support for len() with user-defined classes.

(是也乎:

len

len() 也是一个细思恐极的函式

)

Explaining generics that are—covariant, contravariant or invariant in types, and why it matters while working with type annotations in Python.

(是也乎:

对 types 执着的, 都是复杂大系统中, 多团队协同时

)

A look at how to work with static and media files in a Django project, locally and in production.

(是也乎:

现在基本都得依托某种 CDN 了...

)

(是也乎:

嗯哼? 冰岛?

)


好物/妙品/...

Interesting Projects, Tools and Libraries, Projects & Code

(是也乎:

BeeWare 叕被推荐, iOS, Android, Windows, MacOS, Linux, Web... 全面兼容, 这是怎样的一种野心哪...

)

(是也乎:

PHP 世界中的 *admin 系列作品可都是神品, 就看 Python 世界中的了

)

(是也乎:

实用的, 就看是否能内置解决性能问题了.

)


📆🐍 活动/大会

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


DAMA

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


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


大妈的多重宇宙 - YouTube

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

任何问题

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

-->