issubclass funny business

Les Schaffer godzilla at
Tue Apr 11 20:48:47 EDT 2000

GMcM said:

> You are running FileScanner. Therefore, in FileScanner, class
> StandardArrayFileScanner is defined in __main__. If you trickle up
> to the top of __bases__ above, you'll find
> FileScanner.StandardArrayFileScanner, which is not the same object.

sigh... yep:

>       if not isinstance(std, StandardArrayFileScanner):
>            import cie
>            print std.__class__, cie.CIE.__bases__, cie.CIE_Standards.__bases__

gustav)~/Engineering/dspring/stoplite/matlab/Jue-Data/: python


cie.CIE (<class cie.CIE_Standards at 810d1b8>,) 
(<class FileScanner.StandardArrayFileScanner at 81259f8>,) 

same problem with issubclass.....

            print self.__class__.__bases__

(self is a subclass of ArrayFileScanner) gives:

(<class __main__.ArrayFileScanner at 8124f88>,)

les schaffer

More information about the Python-list mailing list