Google Python Style Guide
Date: 2/11/2023 · Tags: #python, #dev许久不看 Google Python Style Guide 1, 里面推荐的 indentation 已经 2 spaces 改到 4 spaces 了 😅 还自己开发了 PyInk2 补充 Black, 另外也随着 Python 引入的新功能更新了一些有意思的内容 🤗
class A:
def foo(self, obj):
match obj:
case (1, a, 3):
now_you_can_write_functions_or_codes()
case C(x, y):
...
但是因为 Python 里 pattern matching 的语法过于优雅繁琐, 4 spaces 下随便写点 什么, 真正的逻辑代码就已经不知道缩进到哪里去了, 在 Python 里使用 2 spaces 好像我 又可以了...
Footnotes
-
google/pyink: Pyink, pronounced pī-ˈiŋk, is a Python formatter, forked from Black with a few different formatting behaviors. ⤴