I know that python's "is" comparison uses the ID of the object to compare, but it seems to behave inconsistently specifically when comparing a string concatenated with itself. Up to 20, for a single character str, it returns True, then False:
>>>'a'*20 is 'a'*20
True
>>>'a'*21 is 'a'*21
False
With strings of different lengths it seems to happen wherever the total string surpasses 21:
>>>'abcdefghijk'*2 is 'abcdefghijk'*2
False
>>>'abcdefghijk'*1 is 'abcdefghijk'*1
True
But this doesn't apply to strings which are already longer than 21 characters:
>>>'abcdefghijklmnopqrstuvwxyz'*1 is 'abcdefghijklmnopqrstuvwxyz'*1
True
What is python doing that causes this change of behavior?
EDIT: I'm using Python 3.6.5