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 '#'?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Kevin
  • 4,926
  • 2
  • 26
  • 50

1 Answers1

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.

om_henners
  • 15,642
  • 2
  • 46
  • 86