On Fri, Oct 7, 2011 at 10:57 AM, Calvin Spealman <ironfro...@gmail.com> wrote:
> On Fri, Oct 7, 2011 at 10:39 AM, bcrem <billc...@gmail.com> wrote:
>> Howdy,
>>
>> I come from a C/C++ background, getting into some django/python now.
>> I'm used to a one-class/one-file paradigm, and don't much like
>> sticking all the models for an app in models.py.  It's a minor thing,
>> I know...
>>
>> Is there any way to seperate out these classes, and still have syncdb
>> pick them up & update your database for you?
>
> I suggest you learn to write Python when you are writing Python, and
> continue to write C or C++
> when you are writing C or C++.


Even in C++, it's quite common to put several related classes in the
same source file.  the "one class, one file" style is enforced only on
Java, AFAIK.

there's nothing wrong in splitting modules to prevent them from being
unreadable; but in Django, many classes have a declarative style, and
keeping them separated would seem too lonely  :-(

personally, when i see a big models.py, my first idea is to split the
whole app, not to split the file and keep a big app.

Or, when a models.py (or views.py) starts growing not because of
having too many classes; but because there's a lot of functionality on
each one, my reaction is to pull code out of the classes and into a
'utils.py', (or something better named)

anyway, "when in Python, write as Python do" is really good advice.

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to