Hacker News new | past | comments | ask | show | jobs | submit login

Sure. `==` should be used for such comparisons, not `is`, as the latter is semantically different. They have the same effect for "apricot" because Python interns strings up to length 20:

  >>> "1"*20 is "1"*20
  True
  >>> "1"*21 is "1"*21
  False



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: