Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.069 X-Spam-Evidence: '*H*': 0.86; '*S*': 0.00; 'nicely': 0.07; 'obj,': 0.09; 'cc:addr:python-list': 0.10; 'attributes,': 0.16; 'imo.': 0.16; 'cc:2**0': 0.23; 'dependent': 0.23; 'split': 0.23; 'seems': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'looks': 0.26; 'common': 0.26; 'extend': 0.26; 'separate': 0.27; 'obj': 0.29; 'case,': 0.29; 'probably': 0.29; 'class': 0.29; 'classes': 0.30; '-----': 0.32; 'but': 0.36; 'subject:: ': 0.38; 'things': 0.38; 'nothing': 0.38; 'sure': 0.38; 'think': 0.40; 'your': 0.60; 'received:194': 0.61; 'stay': 0.61; 'between': 0.63; 'more': 0.63; 'here': 0.65; "class's": 0.84; 'shocking': 0.84 X-IronPort-AV: E=Sophos;i="4.80,417,1344204000"; d="scan'208";a="723172" X-Virus-Scanned: amavisd-new at zimbra.sequans.com Date: Thu, 13 Sep 2012 17:22:46 +0200 (CEST) From: Jean-Michel Pichavant To: andrea crotti In-Reply-To: Subject: Re: main and dependent objects MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Mailer: Zimbra 7.2.0_GA_2669 (ZimbraWebClient - GC7 (Linux)/7.2.0_GA_2669) Cc: python-list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347549751 news.xs4all.nl 6899 [2001:888:2000:d::a6]:47133 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29041 ----- Original Message ----- > 2012/9/13 Jean-Michel Pichavant : > > > > Nothing shocking right here imo. It looks like a classic > > parent-child implementation. > > However it seems the relation between Obj and Dependent are 1-to-1. > > Since Dependent need to access all Obj attributes, are you sure > > that Dependent and Obj are not actually the same class ? > > > > > > JM > > Yes well the main class is already big enough, and the relation is > 1-1 > but the dependent class can be also considered separate to split > things more nicely.. > > So I think it will stay like this for now and see how it goes. > Difficult to say given the meaningless names you provided. Just in case, you can still split things nicely in 2 classes and still get Dependent to be the same thing than Obj : by inheritance. It is a common way to extend one class's features. class Obj class Dependent(Obj) But do it only if Dependent **is** actually an Obj. If Dependent not an Obj but part of an Obj, then your original implementation is probably the way to go. JM