Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!novso.com!newsfeed.xs4all.nl!newsfeed4.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'insert': 0.05; 'column': 0.07; 'problem:': 0.07; 'append': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:question': 0.10; 'jan': 0.12; 'stored': 0.12; 'hierarchy': 0.16; 'navbar': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.18; 'widget': 0.19; 'header:User- Agent:1': 0.23; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'class': 0.32; 'classes': 0.35; 'instances': 0.36; 'method': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'received:173': 0.61; 'here': 0.66; 'nagy': 0.84; 'received:fios.verizon.net': 0.84; 'children.': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Import order question Date: Mon, 17 Feb 2014 10:35:07 -0500 References: <53020843.5010804@shopzeus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: <53020843.5010804@shopzeus.com> 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392651362 news.xs4all.nl 2970 [2001:888:2000:d::a6]:37271 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66607 On 2/17/2014 8:01 AM, Nagy L=C3=A1szl=C3=B3 Zsolt wrote: > I have a class hierarchy like this: > > Widget <- VisualWidget <- BsWidget > > and then BsWidget has many descendants: Desktop, Row, Column, Navbar et= c. > > Widgets can have children. They are stored in a tree. In order to manag= e > the order of widgets, I need methods to append children. (And later: > insert or prepend because they also have an order). So I would like to > have methods like this: > > BsWidget.AppendNavbar(....) > BsWidget.AppendRow(...) I would write one prepend/insert/append method that=20 prepends/inserts/appends the widget passed. > Here is the problem: these methods should create instances of Row, > Column and Navbar. I disagree, without strong justification. Create the instances by=20 directly calling the classes and do with them as you want. --=20 Terry Jan Reedy