__Classes and type tests

Fredrik Lundh fredrik at pythonware.com
Sun Oct 9 18:49:41 EDT 2005


Brian van den Broek wrote:

> But the academic issue "How/Can it be done?" still itches.

class __TwoUnderBase(object):
      def __init__(self):
          if self.__class__.__name__ == "__TwoUnderBase":
              print "From __TwoUnderBase"
          else:
              print "From subclass",

</F> 






More information about the Python-list mailing list