About one class/function per module

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Wed Nov 4 17:07:00 CET 2009

Peng Yu a écrit :
> On Mon, Nov 2, 2009 at 3:03 AM, Bruno Desthuilliers
> <bruno.42.desthuilliers at websiteburo.invalid> wrote:
>> Peng Yu a écrit :
>> (snip)
>>> I prefer organized my code one class/function per file (i.e per module
>>> in python). I know the majority of programmers don't use this
>>> approach. Therefore, I'm wondering what its disadvantage is.
>> Hmmm... As far as I'm concerned, you already answered your own question:
>> "the majority of programmers don't use this approach".
>> Now, for a much more practical answer:
>> 1/ having to handle thousands of files for even a simple project is a
>> king-size PITA for the maintainer.
>> 2/ having to load thousands of modules will add quite a lot of overhead when
>> actually running the code.
>> 3/ as a result, the poor guy that will end up maintaining your code will
>> positively hate you. Beware : this poor guy might as well be you.
> I still don't understand why it is a nightmare to maintain the code.

Been here, done that.

You obviously don't have enough experience with Python to understand why 
your "organization" suck. And given your apparent tendency to insist on 
imposing your own views / preconceptions on the language instead of 
learning how to use it properly (the canonical "I can write Java in any 
language" syndrom), it will probably take a long time before you get 
there - if you ever get there at all.

My friendly (really) advice is to stop fighting the langage and start 
going with the flow.

(snip lots of stuff that require neither "one line of code per file" nor 
fancy scripts)

More information about the Python-list mailing list