AnsweredAssumed Answered

Python, the difference between properties with () and without ()

Question asked by zieglerhm_CDMSmith on May 3, 2018
Latest reply on May 3, 2018 by bixb0012

Hello, I may be missing an important detail about how Python works, and I wanted to see if anyone could help clarify. Short story short  I needed to obtain a string list of domain values for a certain domain of a featureclass I was using, so I put the following code into python window after looking up the necessary classes/functions I needed to obtain said information.

 

[x for x in arcpy.da.ListDomains(r'Path_To_Geodatabase'if x.name == u'dPubFunctionalClass'][0].codedValues() 

This gave me the following error:

Runtime error

Traceback (most recent call last): File "<string>", line 1, in <module>

TypeError: 'dict' object is not callable

Removing the parenthesis after .codedValues does the trick.

 

My guess is that .codedValues is not a method of the class Domain, but rather just a variable (a dictionary object) stored within that class. Is this why I get an error message when I attempt to type the .codedValues() instead of just .codedValues?

 

Thank you!

Outcomes