[Tutor] Two problems related to dispathing.

Alan Gauld alan.gauld at btinternet.com
Tue Jul 28 20:03:27 CEST 2009


"Mac Ryan" <quasipedia at gmail.com> wrote


> above function. In fact, as I have the need to access the object both
> individually and with the dispatcher, I am doing something like this
> every time I instantiate a new object: 
> 
> <code>
> mycontent = ContentA()
> contents.append(mycontent)
> </code>
> 
> ...but although I "feel" this is silly, I can't imagine how to get it
> better (i.e. a single call that will make available the object with his
> unique name and append it to the list of contents.

There is no simpler solution without changing the class.
If you can do that you could pass the container to the constructor 
and get the class to add itself to the container....

HTH,

Alan G.



More information about the Tutor mailing list