Pythonic 库的好例子有哪些?

发布于 2024-09-06 19:16:30 字数 1431 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情愿 2024-09-13 19:16:30

你看过Python标准库源代码吗?它可以让您了解正确的 Python 风格的不同特性。并非所有人都遵循 PEP 8,但您只需看看就可以学到很多东西。我建议您查看单个文件中包含的模块,以便了解完整情况。源中的具体示例包括:

  1. CSV
  2. ConfigParser

请记住,这并不意味着这些模块应该被视为“示例性 Python 代码”,但要点仍然是:它们足够好,可以包含在标准 Python 发行版中。

对于更复杂的模块,请查看标准电子邮件包或 Django 源代码。同样,不一定遵循 PEP 8,但已被数千人使用(并受到许多人的喜爱)。

公平地说,明天令人惊叹的 Python 代码与今天良好的工作代码之间存在着平衡。

干杯,

胡安

Have you taken a look at the Python standard library source code? It can give you an idea of the different idiosyncrasies for proper Python style. Not all of them follow PEP 8, but you can learn a lot just by looking. I recommend you look at modules contained in a single file, so that you get the full picture. Specific examples within the source include:

  1. CSV
  2. ConfigParser

Keep in mind that this does not mean that these modules should be taken as "exemplary Python code" but the point remains: they are good enough as for them to be included in the standard Python distribution.

For more complex modules, take a look at the standard Email package, or the Django source code. Again, not necessarily following PEP 8, but used by thousands (and loved by many).

It's fair to say that there is a balance between amazing Python code tomorrow versus decent working code today.

Cheers,

Juan

温柔少女心 2024-09-13 19:16:30

boto3。很棒的测试套件和包结构。 Celery 也是如此。

boto3. Great test suite and package structure. Same for Celery.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文