9

I recently exported an ArcGIS model to python and was reviewing the script and am confused by the following line:

if TRU_W_DatableFeatures == '#' or not TRU_W_DatableFeatures:

What is the role of the '#'?

1 Answer 1

12

You'll notice that TRU_W_DatableFeatures is an optional input. When ArcGIS calls a Python script with optional arguments it will pass in a # in place of an optional argument that has not been filled out. This is because Python arguments are positional.

Otherwise if you were calling this script from Python instead of ArcGIS you (may) not set TRU_W_DatableFeatures.

So this if statement is checking for the existence of TRU_W_DatableFeatures, and whatever is within this if statement will only be performed if TRU_W_DatableFeatures exists.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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