issubclass funny business

Les Schaffer godzilla at netmeg.net
Wed Apr 12 02:48:47 CEST 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 FileScanner.py


prints:

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

same problem with issubclass.....

whilst:
            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