6

I do a lot of testing in the Python window in ArcGIS Desktop (10.4.1). It's great, especially because it autocompletes code for me.

enter image description here

It will autocomplete for most objects:

enter image description here

However, something that has always annoyed me is that it won't autocomplete for arcpy.Describe objects.

enter image description here

Why is that?

7

Because the properties of a 'Describe' object are not a fixed list as they are for the other object types in your autocomplete examples. The list of properties depends on the type of object passed to arcpy.Describe(). As the Esri documentation puts it:

The Describe function returns a Describe object, with multiple properties, such as data type, fields, indexes, and many others. Its properties are dynamic, meaning that depending on what data type is described, different describe properties will be available for use.

( http://desktop.arcgis.com/en/arcmap/10.4/analyze/arcpy-functions/describe.htm )

Update: The Python editor gets its autocomplete list from an object's type rather than from an instance of an object.

Although there may be ways to query an object instance for all of its available attributes, this is not how the editor works (and such methods may or may not be appropriate for this context).

For some more discussion on accessing all the attributes of an object instance, see

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.