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


Groups > comp.lang.python > #109503

Re: Spreading a class over multiple files

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: Spreading a class over multiple files
Date Sun, 05 Jun 2016 09:40:19 +0200
Organization None
Lines 19
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>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Trace news.uni-berlin.de hlOa7w5eyqJDV+fB9P6J5gK7VEnhCXLZiLMbFD+unoXQ==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:files': 0.09; 'files.': 0.13; 'composition.': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:class': 0.16; 'wrote:': 0.16; 'differ': 0.18; 'tables': 0.23; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'question': 0.27; 'reflect': 0.27; 'structure,': 0.29; 'url:wiki': 0.30; 'primary': 0.31; 'point': 0.33; 'class': 0.33; 'this?': 0.34; 'instance': 0.35; 'requiring': 0.35; 'sometimes': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'spread': 0.37; 'to:addr:python.org': 0.40; 'mark': 0.40; 'received:de': 0.40; 'entire': 0.61; 'provide': 0.61; 'needs,': 0.63; 'url:cgi': 0.66; 'god': 0.67; 'subject:over': 0.84
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host p57bd9cdd.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <nj0l14$ps$2@ger.gmane.org>
X-Mailman-Original-References <f8f1cc30-3274-4274-9e28-815b32b4e27c@googlegroups.com>
Xref csiph.com comp.lang.python:109503

Show key headers only | 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