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


Groups > comp.lang.python > #66607

Re: Import order question

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Import order question
Date 2014-02-17 10:35 -0500
References <53020843.5010804@shopzeus.com>
Newsgroups comp.lang.python
Message-ID <mailman.7099.1392651362.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 2/17/2014 8:01 AM, Nagy László Zsolt wrote:
> I have a class hierarchy like this:
>
> Widget <- VisualWidget <- BsWidget
>
> and then BsWidget has many descendants: Desktop, Row, Column, Navbar etc.
>
> Widgets can have children. They are stored in a tree. In order to manage
> 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 
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 
directly calling the classes and do with them as you want.

-- 
Terry Jan Reedy

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


Thread

Re: Import order question Terry Reedy <tjreedy@udel.edu> - 2014-02-17 10:35 -0500

csiph-web