3

ArcPy has a number of functions for listing data, and I will use just one of them as an example. However, what I ask seems to apply to all of them.

In the Syntax section of the help for ListFeatureClasses it says that the Data Type of its Return Value is a String.

enter image description here

However, whenever I use the function what is returned is a Python list, which is what I would expect and desire.

Is there some convention that I am not aware of whereby a Python list can be classified as a string, or should this Return Value be documented as a List instead?

  • 1
    Agree, I too have found the return types to be confusing. I would prefer it to be clearly stated it is a list object containing strings. Currently one has to read data type and explanation to truly understand what is actually being returned. – Hornbydd May 1 '18 at 18:12
2

No there's no convention where lists can be considered strings (though a string is iterable like a list, tuple, etc...)

In my opinion, the return value could be documented as a "list of strings" ala sphinx api doc type definitions.

However, that a list of "something" (i.e filepaths, index objects, fields, layers) is returned is specifically stated in the Explanation column. And the data type column tells you that each "something" will be of the specified data type.

E.g

enter image description here

So I don't think the data types are incorrectly documented, but possibly could be more clearly documented (i.e. list of "something" in the data type column).

I would not like to see data type documented as just "list". The iterable is mostly irrelevant, it's the elements that I need to know the data type of.

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.