Describe properties

Idea created by niklas.norrthonesri-se-esridist Employee on Jan 24, 2011
    New
    Score20
    The arcpy Describe function returns a "description" object. The properties of the description object depends on what is being described. Feature classes has things like "featureType", "hasM", "hasZ" et cetare. Raster Datasets has things like "bandCount", "format" and so on.

    A few properties like "catalogPath" and "dataType" are common to all description objects. There is (as far as I can tell) no easy way in code to find out which properties that are valid for a "random" description object. For normal python objects you can say dir(object) and get a list of object attributes.

    My proposal is to let the arcpy description objects implement the __dir__ special function, which will return a list of valid properties for the object.

    Advantages are:

    Simplified dynamic programming: A program can do:
    desc = arcpy.Describe(something)
    for prop in dir(desc):
        print '%s: %r' % (prop, getattr(desc, prop)

    Simplified development and debugging.
    I find myself using dir(something) a lot both while testing during development and after crashes in debugging.