On Sun, Dec 25, 2011 at 11:10 PM, Steven D'Aprano
<steve+comp.lang.pyt...@pearwood.info> wrote:
> class Point:  # An abstract class.
>    def intersect(self, other):
>        blah; blah; blah
>        return Point(x, y)  # No, wrong, bad!!! Don't do this.
>
> Instead:
>
>        return self.__class__(x, y)  # Better.

This would work if you were dealing with the intersection of two
points, but how do you use that sort of trick for different classes?

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

Reply via email to