Type emulation issues with new style classes

Rainer Deyke rainerd at eldwood.com
Sat Feb 28 19:34:19 CET 2004


Chris wrote:
> class Z(object):
>     value = 42
>     def __hasattr__(self, name):
>         if name == '__int__':
>             return True
>     def __getattr__(self, name):
>         if name == '__int__':
>             return lambda: self.value
      def __int__(self):
        return self.__getattr__('__int__')()


-- 
Rainer Deyke - rainerd at eldwood.com - http://eldwood.com





More information about the Python-list mailing list