I got a tiny script:

def calc(value):
 if value is '123':
    return 'ok'
 elif value is '12 3':
    return 'not_ok'
    return value

if the value is without spaces it works perfectly, but if there is a space in it, it just returns the value. Where is my error? :)

closed as off-topic by Fezter, PolyGeo, Jason Scheirer, Aaron, Zachary Jul 16 '13 at 12:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development are off-topic here unless they relate directly to Geographical Information Systems, but they can be asked on Stack Overflow." – Fezter, PolyGeo, Jason Scheirer, Aaron, Zachary
If this question can be reworded to fit the rules in the help center, please edit the question.


Rather than use is try the == operator.

  • 1
    This is a Python question, not specific to arcpy. – Oyvind Jul 15 '13 at 11:05
  • Strictly speaking I suspect it is an ArcGIS Field Calculator question related to its Python parser but nevertheless I agree that it is more about Python than ArcGIS. – PolyGeo Jul 15 '13 at 11:30

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