Files application architecture

Benjamin Watine watine at cines.fr
Mon Sep 8 11:44:33 EDT 2008


Bruno Desthuilliers a écrit :
> Benjamin Watine a écrit :
>> Hi,
>>
>> I'm about to develop a small python application and I wonder how to 
>> organize files in this application.
>> I'm familar to java, so I'm tempted to use the same convention
> 
> http://dirtsimple.org/2004/12/python-is-not-java.html
> 
>> : 1 file per class and 1 folders per package.
> 
> Don't. This is a waste of time and a pain to maintain, and more over it 
> doesn't make any sense since Python doesn't force you to put everything 
> in classes.
> 
>> I know that packages doesn't exists in python,
> 
> Did you actually read the doc ? While Python's packages are not the same 
> thing as Java's, they do exist.
> 
> http://docs.python.org/tut/node8.html#SECTION008400000000000000000
> 
>> they are modules instead. May I create specific module for each "group 
>> of class" ?
> 
> The usual way to get cohesive modules is indeed to group closely related 
> objects (classes, functions, etc) in a same module.
> 
>> My application follow the MVC paradigm, so basically, I've a package 
>> Model, a package View, and a package Controller.
> 
> If your app is small, having _modules_ models, views and controllers 
> should be enough.
> 
>> So, what are best practices for organizing files and folders in a 
>> small python project ?
> 
> The best practice is to keep things simple, as usual.
> 

Thank you all for your good advices and links. I'm new to python and I 
have yet a lot of things to learn !

Now, I would like to take a look to a well coded wxPython application. 
Could anybody indicate a project that I could take as reference for 
standard python coding style ?

Regards,

Ben



More information about the Python-list mailing list