I am raising exceptions in two different places in my Python code:
holeCards = input("Select a hand to play: ")
try:
if len(holeCards) != 4:
raise ValueError(holeCards + ' does not represent a valid hand.')
AND (edited to correct raising code)
def __init__(self, card):
[...]
if self.cardFace == -1 or self.cardSuit == -1:
raise ValueError(card, 'is not a known card.')
For some reason, the first outputs a concatenated string like I expected:
ERROR: Amsterdam does not represent a valid hand.
But, the second outputs some weird hybrid of set and string:
ERROR: ('Kr', 'is not a known card.')
Why is the "+" operator behaving differently in these two cases?
Edit: The call to init looks like this:
card1 = PokerCard(cardsStr[0:2])
card2 = PokerCard(cardsStr[2:4])