> Is this meant to be an optimization?

On Python 3, types are unorderable and can't be compared, so this would result in an exception being raised when the resource is a class.