Hacker News new | ask | show | jobs
by tomtimtall 2652 days ago
“A”+”B” what do you feel should happen? “A”*6 what do you feel should happen?
2 comments

  "A"+"B" = Regex("A|B") = Regex("[AB]") # or maybe
  "A"+"B" !> [?]Error: cannot convert /A|B/ to type str
  "A"*6 !> TypeError: <str> * <int>
> “A”+”B” what do you feel should happen?

Clearly, that should be undefined. You cannot sum two strings. Unless you are really deranged and you want it to be "C".