how to dispatch objects depending on their class

Curzio Basso curzio.basso at unibas.ch
Wed Aug 11 03:56:52 EDT 2004


Peter Abel wrote:

> At my opinion you try to do something outside a class which should
> be a basic task of OOP. Why not let the instances do their class-specific
> things:

I know that this situation would be typically handled by putting the 
logic in the class hierarchy, but as I wrote I don't want this. In fact, 
as cmedcoff at hotmail.com pointed out, at the end what I want to implement 
is a visitor pattern (maybe I should have simply mentioned this). In C++ 
then the right implementations are chosen at compile time because of the 
function overloading, but in Python I have to find a different way to 
implement this.

cheers, curzio



More information about the Python-list mailing list