TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Python Script Best Practices?

20 点作者 shlip超过 2 年前
I recently stumbled on this article about Shell Script Best Practices (https:&#x2F;&#x2F;sharats.me&#x2F;posts&#x2F;shell-script-best-practices&#x2F;) here on HN and appreciated the format (concise, curated, well explained, based on experience).<p>I was wondering if someone knows of a similar ressource for python ?

3 条评论

j0hnyl超过 2 年前
<a href="https:&#x2F;&#x2F;peps.python.org&#x2F;pep-0008&#x2F;" rel="nofollow">https:&#x2F;&#x2F;peps.python.org&#x2F;pep-0008&#x2F;</a>
评论 #33458588 未加载
wodenokoto超过 2 年前
Read pep8, as others suggest, but don’t use a linter.<p>&gt; However, know when to be inconsistent – sometimes style guide recommendations just aren’t applicable. When in doubt, use your best judgment. Look at other examples and decide what looks best.<p>-pep8
评论 #33465038 未加载
4oo4超过 2 年前
Use a linter, personally pylint has helped me learn to write more &quot;Pythonic&quot; code. If you&#x27;re using vscode, you can easily integrate it or any other python linter.<p><a href="https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;visualstudio&#x2F;python&#x2F;linting-python-code?view=vs-2022" rel="nofollow">https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;visualstudio&#x2F;python&#x2F;lintin...</a><p>If you also want a linter for bash, check out shellcheck: <a href="https:&#x2F;&#x2F;github.com&#x2F;koalaman&#x2F;shellcheck" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;koalaman&#x2F;shellcheck</a>