200 行 Python 检验基本音乐理论

原文: PyCoder's Weekly - Issue #469

pycoder

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

Along your Python learning journey, someone may have told you that a great way to level up your skills is to read code written by other people. That’s definitely true, but it’s not easy to find good sources of code to read and study. Python offers some advantages here because not only is the code open source, but the discussion surrounding design decisions is public, too.

(是也乎:

阅读代码? 其实, 就是用经验在运行代码. 如果经验不足以理解, 那就应该第一时间真实运行起来...

)

Learn about Python text classification with Keras. Work your way from a bag-of-words model with logistic regression to more advanced methods leading to convolutional neural networks. See why word embeddings are useful and how you can use pretrained word embeddings. Use hyperparameter optimization to squeeze more performance out of your model.

(是也乎:

Keras

纱翁总是逃不了的, 只是在中国, 很少有团队拿毛选来作分析数据...

)

The Django template language has some powerful features that can simplify your templates and solve a number of problems. Learn about eight template tags that you might not have heard of in this listicle that’s full of practical examples.

(是也乎:

从终极 -> 精通 -> 流畅 -> ...

技术界的用词总是一阵阵儿的...

)

If you mistype an attribute name, you’ll get suggestions from existing attributes!

(是也乎:

工头

)


探讨/吐糟

Discussions

Python 3.7 introduced postponed evaluation of type annotations behind the from future import annotations switch, a feature originally proposed in PEP 563. Libraries like pydantic, used extensively in the popular FastAPI framework, have found it difficult to support PEP 563, which is set to become the default in Python 3.10. A new PEP aims to alleviate some of the issues, but sentiment is mixed.

(是也乎:

无论 Python 怎么升级, Py2.7.10 总是好用的.

嘦 老爹不死, 总是可以号称 Pythonic 的...

)

If you thought this unusual expression would return an error, you’re not alone. There’s actually a lot of nuance to how this works, and would probably trip up even experienced Python devs. See this tweet from Ned Batchelder for even more discussion.

(是也乎:

这类为毛系统质问, JS 世界最多...

)


文章/教程/嗯哼

Articles, Tutorials and Talks

Music has always had a close relationship with mathematics and makes heavy use of repeated patterns and formulas. These characteristics make music ripe for investigation with code. This article covers some of the basics of Western music theory with examples in Python. The article is quite accessible — no knowledge of reading sheet music needed! After you’ve read the article, check out the discussion on Hacker News.

(是也乎:

有趣...

{'Aeolian': ['C', 'D', 'Eb', 'F', 'G', 'Ab', 'Bb'],
 'Dorian': ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb'],
 'Ionian': ['C', 'D', 'E', 'F', 'G', 'A', 'B'],
 'Locrian': ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb'],
 'Lydian': ['C', 'D', 'E', 'F#', 'G', 'A', 'B'],
 'Mixolydian': ['C', 'D', 'E', 'F', 'G', 'A', 'Bb'],
 'Phrygian': ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']}

用程序自动生成和弦?

)

Are you looking for a bit of order when working with dictionaries in Python? Are you aware that the Python dict has changed over the last several versions and now keeps items in order? Could you learn more about object-oriented programming in Python by comparing it to another language? Find out more in this week’s installment of the Real Python Podcast.

(是也乎:

56

毫无感觉就到56期了, 自怼圈也是, 这周6已经是第210次直播了...

)

Have you ever wondered how the barcodes you see on products work? Did you know that the first barcodes originated from Morse code? This article teaches you how UPC-A barcodes, one of the current barcode standards, work and how you can create them from scratch using Python.

(是也乎:

Barcode

这是一个大家族...

)

In this step-by-step tutorial, you’ll learn how to create a Python Flask example web application and deploy it using Heroku. You’ll also learn how to set up Heroku Pipelines to create a deployment workflow with staging and production environments.

(是也乎:

Heroku

Heroku 的确是个令人愉快的游乐场, 但是, 真心不是一个可作生产环境的地方...

)

In this step-by-step project, you’ll create a Python directory tree generator application for your command line. You’ll code the command-line interface with argparse and traverse the file system using pathlib.

(是也乎:

Directory

tree 指令的山寨过程...

CLI

)


好物/妙品/...

Interesting Projects, Tools and Libraries, Projects & Code

(是也乎:

Split-Flap

Hard core, 没用任何公板, 从0设计制造.

)

(是也乎:

Julia 想说: やめて

)

(是也乎:

K8s 的复杂, 促进了工具市场的嗯哼...

)

(是也乎:

import simplematch as sm

def mood_convert(smiley):
    moods = {
        ":)": "good",
        ":(": "bad",
        ":/": "sceptic",
    }
    return moods.get(smiley, "unknown")

sm.register_type("smiley", r":[\)\(\/]", mood_convert)

sm.match("I'm feeling {mood:smiley} *", "I'm feeling :) today!")
>>> {"mood": "good"}

怎么也学习不会正则表达式的福音...

)


📆🐍 活动/大会

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

(是也乎:

即便是线上的, 一样收费.

)

-⋅ GeoPython 2021 + April 22 – 24, 2021

(是也乎:

以色列, 全球创新热点地区...

)

(是也乎:

反正很早都上 油管了, 随时可以 review, 当然, 这个随时, 随时了很多年都没刷光.

)


DAMA

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

(是也乎:

独创 logging + debug 模块

)

(是也乎:

老司机开新坑, 时隔10年, 沈游侠再次开声, 值得关注:

Bilibili

)

(是也乎:

私人初体验, 现在 http/https 资源混用浏览器越来越傲娇了, 最好有工具可以统一迁移...

)


PS:


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

投稿/反馈邮箱:

askdama@googlegroups.com

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


ZoomQuiet/大妈

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

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

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

NN 4341

RPP


Comments


大妈的多重宇宙 - YouTube

全新自媒体系列...科学幻想,读书,说故事...
点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

订阅 substack 体验古早写作:
Zoom.Quiet’s Chaos42 | Substack


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


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

**2021.01.11** 因大妈再次创业暂停定期开设, 转换为预约触发:
  • + 任何问题, 随时邮件提问可也:
    askdama@googlegroups.com
-->