本文介绍了如何使用Python进行大规模开发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很想学习Python的大规模开发,尤其是如何维护大型代码库?

I would be interested to learn about large scale development in Python and especially in how do you maintain a large code base?


  • 对方法签名进行不兼容更改时,如何找到调用该方法的所有位置。在C ++ / Java中,编译器会为您找到它,如何在Python中找到它?

  • When you make incompatibility changes to the signature of a method, how do you find all the places where that method is being called. In C++/Java the compiler will find it for you, how do you do it in Python?

在代码内部进行更改时,您如何找出实例提供的操作,因为您没有静态类型要查找?

When you make changes deep inside the code, how do you find out what operations an instance provides, since you don't have a static type to lookup?

如何处理/防止键入错误(打字错误)?

How do you handle/prevent typing errors (typos)?

UnitTest是否可以代替静态类型检查?

Are UnitTest's used as a substitute for static type checking?

您可以猜到我几乎只使用静态类型的语言(C ++ / Java),但我想尝试使用Python编写大型程序。但是很久以前,我对使用Clipper(dBase)语言(也是动态键入)感到非常糟糕。

As you can guess I almost only worked with statically typed languages (C++/Java), but I would like to try my hands on Python for larger programs. But I had a very bad experience, a long time ago, with the clipper (dBase) language, which was also dynamically typed.

推荐答案

因为没有人指出pychecker,pylint和类似工具,所以我会:pychecker和pylint是可以帮助您找到错误假设的工具(关于函数签名,对象属性等),它们无法找到编译器可能找到的所有内容

Since nobody pointed out pychecker, pylint and similar tools, I will: pychecker and pylint are tools that can help you find incorrect assumptions (about function signatures, object attributes, etc.) They won't find everything that a compiler might find in a statically typed language -- but they can find problems that such compilers for such languages can't find, too.

Python(和任何动态类型的语言)从根本上说是静态类型的语言,但是他们会发现这类语言的编译器也找不到的问题。在您可能导致的错误以及如何检测和修复它们方面有所不同。它既有缺点,也有缺点,但是许多人(包括我)都认为,在Python的情况下,编写代码的难易程度(使其在结构上合理)和修改代码而不会破坏 API兼容性(添加新的可选参数,提供具有相同方法和属性集的不同对象)使其适合大型代码库。

Python (and any dynamically typed language) is fundamentally different in terms of the errors you're likely to cause and how you would detect and fix them. It has definite downsides as well as upsides, but many (including me) would argue that in Python's case, the ease of writing code (and the ease of making it structurally sound) and of modifying code without breaking API compatibility (adding new optional arguments, providing different objects that have the same set of methods and attributes) make it suitable just fine for large codebases.

这篇关于如何使用Python进行大规模开发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 15:28