[Tutor] advice on structuring a project

Serdar Tumgoren zstumgoren at gmail.com
Tue Oct 6 20:26:06 CEST 2009

Hi everyone,

I was wondering if anyone could offer advice as I try to simplify a
project I've been working on.

I have a set of classes that I've named models.py (following the
Django convention, though it's not technically a Django project or

Inside that file, I had initially grouped together a number of
classes, subclasses and mixin classes. I've broken out the mixins into
a separate file and am now importing those as a module, which has
helped tame models.py quite a bit. Now I'm left with a number of
subclasses that add in certain functionalities that are not central to
the models themselves.

For instance, I have a class called FilingsParser and then a
FilingsParserAuto subclass which just triggers methods on the
FilingsParser when an instance is created:

class FilingsParserAuto(FilingsParser):
    A subclass of FilingsParser that adds methods for handling
    House candidate committee filings.
    def __init__(self):
        super(FilingsParserAuto, self).__init__()

That subclass is the one I'm using in a separate program that relies
on the "autofire" behavior. I have a number of these Auto subclasses
and it's resulted in a bit of bloat inside models.py.

So to finally ask the question -- would the above subclasses be better
defined as part of the program that requires the "auto" behavior? Or
is it preferable to create some sort of API or Auto module where these
sublasses live? I can see myself needing this behavior for other
projects, but again, it really isn't part of the core functionality of
the classes defined in models.py. I guess I'm wondering if there's a
convention for how to handle this type of thing...

Advice is greatly appreciated.


More information about the Tutor mailing list