Re: __Classes and type tests

2005-10-10 Thread Peter Otten
Brian van den Broek wrote: The code below exhibits an attempt to refer to the type of a __Class from within a method of that class. I've been unable to figure out how to make it work as I want, and would appreciate any insight. The problem emerged out of a bad design that the good folks on

__Classes and type tests

2005-10-09 Thread Brian van den Broek
Hi all, The code below exhibits an attempt to refer to the type of a __Class from within a method of that class. I've been unable to figure out how to make it work as I want, and would appreciate any insight. The problem emerged out of a bad design that the good folks on the tutor list helped

Re: __Classes and type tests

2005-10-09 Thread Fredrik Lundh
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

Re: __Classes and type tests

2005-10-09 Thread Brian van den Broek
Fredrik Lundh said unto the world upon 2005-10-09 17:49: 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