def __lt__(self, other):
if self.is_compatible(other):<EOL><INDENT>for i in range(max(self.length, other.length)):<EOL><INDENT>if self.length > i:<EOL><INDENT>self_item = self.key[i]<EOL><DEDENT>else:<EOL><INDENT>self_item = None<EOL><DEDENT>if other.length > i:<EOL><INDENT>other_item = other.key[i]<EOL><DEDENT>else:<EOL><INDENT>other_item = None<EOL><DEDENT>if self_item is None:<EOL><INDENT>if isinstance(other_item, integer_type):<EOL><INDENT>self_item = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>self_item = other_item<EOL><DEDENT><DEDENT>if other_item is None:<EOL><INDENT>if isinstance(self_item, integer_type):<EOL><INDENT>other_item = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>other_item = self_item<EOL><DEDENT><DEDENT>if self_item != other_item:<EOL><INDENT>if not isinstance(self_item, integer_type) or not isinstance(other_item, integer_type):<EOL><INDENT>self_item = str(self_item)<EOL>other_item = str(other_item)<EOL><DEDENT>if self_item < other_item:<EOL><INDENT>return True<EOL><DEDENT>if self_item > other_item:<EOL><INDENT>return False<EOL><DEDENT><DEDENT><DEDENT>return False<EOL><DEDENT>else:<EOL><INDENT>return NotImplemented<EOL><DEDENT>
Less than comparison for natural order sorting keys.