On May 5, 9:01 am, Chris Rebert <c...@rebertia.com> wrote:
> On Tue, May 5, 2009 at 8:52 AM, George Oliver <georgeolive...@gmail.com> 
> wrote:

> > I create instances of these classes in a list attached to a third,
> > 'brain' class.
>
> You could exploit Python's dynamism by using the getattr() function:


Thanks for the responses -- I should have mentioned that I looked at
the getattr() function, but as I instantiate the key handler and
command handler classes in a list (like handlers = [command_handler(),
keyboard_handler()], I'm unsure how to reference that class instance
in the getattr in a straightforward way (short of keeping track of
each instance's position in the handlers list). Is there a typical way
of doing that?

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

Reply via email to