Re: Files application architecture

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gabriel Genellina

    Re: Files application architecture

    En Fri, 05 Sep 2008 12:53:12 -0300, Benjamin Watine <watine@cines.f r>
    escribió:
    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 : 1 file
    per class and 1 folders per package.
    You don't *have* to artificially restrict yourself to one class per file.
    In Python it's common to place several related classes in the same module
    (i.e., file). You don't have to write so much boilerplate code as in Java,
    so classes tend to be smaller in size; you may even find classes with an
    empty body.
    I know that packages doesn't exists in python, they are modules instead.
    Uh? Have you read the Python Tutorial?

    So, what are best practices for organizing files and folders in a small
    python project ?
    I've found PEP8 (http://www.python.org/dev/peps/pep-0008/) that gives a
    lot of good hints on coding convention, but nothing about files
    organization.
    A small application may consist of just a main entry point and some
    imported modules, all residing in the same directory. It might not require
    to define any package. Perhaps later, when some module grows too much, you
    may want to refactor it, creating a package. But try to keep simple things
    simple.

    --
    Gabriel Genellina

Working...