[Python-Dev] Split unicodeobject.c into subfiles?

Victor Stinner victor.stinner at gmail.com
Sun Oct 7 23:17:27 CEST 2012


> The amount of code will not be reduced, but now you also need to guess what
> file some piece of functionality may be in.

How do you search a piece of code? If you search for a function by its
name, it does not matter in which file it is defined if you an IDE or
vim/emacs with a correct configuration. For example, I type ":tag
PyUnicode_Format" to go to the PyUnicode_Format() function.

> Instead of having my text editor
> (Emacs) search in one file, it will have to search across multiple files -
> but not across all open buffers, but only some of them (since I will have
> many other source files open as well).

Does it mean that it would be more practical to merge all C files into
one unique file?

> I really fail to see what problem people have with large source files.
> What is it that you want to do that can be done easier if it's multiple
> files?

Another problem with huge files is to handle "dependencies" with
static functions. If the function A calls the function B which calls
the function C, you have to order A, B and C "correctly" if these
functions are private and not declared at the top of the file.

If functions are grouped correctly, you just lhave to add the function
to the right file, or reorder the files.

I also prefer short files beacuse it's easier to review/audit a small
file. My brain cannot store too many functions :-)

Victor


More information about the Python-Dev mailing list