moving LatLongBoundingBox?

Russell Nelson nelson at crynwr.com
Sun Dec 19 18:22:37 CET 2004


I notice that RasterLayer is using this definition of LatLongBoundingBox:
    def LatLongBoundingBox(self):
        bbox = self.BoundingBox()
        if bbox is None:
            return None

        if self.projection is not None:
            bbox = self.projection.InverseBBox(bbox)

        return bbox

And Layer is using this definition:
    def LatLongBoundingBox(self):
        bbox = self.BoundingBox()
        if bbox is not None and self.projection is not None:
            bbox = self.projection.InverseBBox(bbox)
        return bbox


They both do the same thing, and both classes are derived from
BaseLayer, so shouldn't it be defined in BaseLayer?  I'd pick the
first of the two because it's more clear.  Also, I would use this
Python ideom:

        if self.projection:

rather than this:

        if self.projection is not None:

The first is more clear than the second, which essentially involves
two negatives.  Negatives are harder to process mentally.  Yes, I
realize that these are not equal tests (although they are equivalent).
If the first is not as efficient as the second, then we should submit
a PEP.

-- 
--My blog is at angry-economist.russnelson.com  | Freedom means allowing
Crynwr sells support for free software  | PGPok | people to do things the
521 Pleasant Valley Rd. | +1 315-323-1241 cell  | majority thinks are
Potsdam, NY 13676-3213  | +1 212-202-2318 VOIP  | stupid, e.g. take drugs.




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)