Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109503

Re: Spreading a class over multiple files

From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: Spreading a class over multiple files
Date 2016-06-05 09:40 +0200
Organization None
Message-ID <mailman.6.1465112705.2306.python-list@python.org> (permalink)
References <f8f1cc30-3274-4274-9e28-815b32b4e27c@googlegroups.com> <nj0l14$ps$2@ger.gmane.org>

Show all headers | View raw


Mark Summerfield wrote:

> Sometimes I want to spread a class over multiple files.
> 
> My primary use case is when I create a "Model" class to reflect an entire
> SQL database. I want a model instance to provide a single point of access
> to
>  the database, but the database has many tables each requiring its own
>  methods since they differ in their structure, purpose, validation needs,
>  etc.

In other words, a God Class

http://c2.com/cgi/wiki?GodClass

> My question is -- are there nicer/better ways to achieve this?

Use composition.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Spreading a class over multiple files Mark Summerfield <list@qtrac.plus.com> - 2016-06-04 23:55 -0700
  Re: Spreading a class over multiple files Gary Herron <gherron@digipen.edu> - 2016-06-05 00:18 -0700
    Re: Spreading a class over multiple files Mark Summerfield <list@qtrac.plus.com> - 2016-06-05 01:14 -0700
      Re: Spreading a class over multiple files Steven D'Aprano <steve@pearwood.info> - 2016-06-05 20:57 +1000
  Re: Spreading a class over multiple files Peter Otten <__peter__@web.de> - 2016-06-05 09:40 +0200
  Re: Spreading a class over multiple files Terry Reedy <tjreedy@udel.edu> - 2016-06-05 13:59 -0400

csiph-web