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


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to