issubclass funny business

Les Schaffer godzilla at netmeg.net
Tue Apr 11 17:24:20 CEST 2000


I have the following class hierarchy:

------ in module FileScanner -----

class StandardArrayFileScanner(ArrayFileScanner):

--------- in module cie ----------

from FileScanner import StandardArrayFileScanner

class CIE_Standards(StandardArrayFileScanner):
...    

class Photopic(CIE_Standards):
...

class CIE(CIE_Standards):
...


but when i need to test whther an object is an instance of a subclass
of StandardArrayFileScanner:

        # make sure std is of the correct type
        if not issubclass(std.__class__, StandardArrayFileScanner):
            import cie
            print std.__class__, cie.CIE.__bases__
	    raise NotStandardArrayError


but it doesnt work, even though std is of type cie.CIE :

(gustav)~/Engineering/dspring/stoplite/matlab/Jue-Data/: python FileScanner.py

cie.CIE (<class cie.CIE_Standards at 813b320>,)  <=== result of print stmt

huh??????

les schaffer



More information about the Python-list mailing list