Allen Peloquin wrote:
> class B
> {
>     fun(A x, A y, A z)...
>     fun(A1 x, A y, A z)...
> }
> 
> class B1
> {
>     fun(A1 x, A y, A z)...
> }
> 
> Such that any previous behavior is inherited, but behaves
> polymorphically because of the single function name.

Try something like this:

class B(object):
    def fun(x,y,z):
        if isinstance(x, A1):
            return self._fun(x,y,z)
        # ...

    def _fun(x,y,z):
        # ...

class B1(B):
    def _fun(x,y,z):
        # ...


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

Reply via email to