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: References: 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com comp.lang.python:109503 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.