Prefer '\0' to None or an empty string for single characters.

This commit is contained in:
Emmanuel Gil Peyrot 2015-10-25 13:17:35 +00:00
parent 58d66ad03b
commit 739793e9bc
2 changed files with 2 additions and 2 deletions

View file

@ -400,7 +400,7 @@ def read_tuple(_str):
Read a tuple dumped with dump_tumple Read a tuple dumped with dump_tumple
""" """
attrs = _str.split(',') attrs = _str.split(',')
char = attrs[2] if len(attrs) > 2 else None char = attrs[2] if len(attrs) > 2 else '\0'
return (int(attrs[0]), int(attrs[1])), char return (int(attrs[0]), int(attrs[1])), char
def to_curses_attr(color_tuple): def to_curses_attr(color_tuple):

View file

@ -35,7 +35,7 @@ def parse_attrs(text, previous=None):
if next_attr_char + 1 < len(text): if next_attr_char + 1 < len(text):
attr_char = text[next_attr_char+1].lower() attr_char = text[next_attr_char+1].lower()
else: else:
attr_char = str() attr_char = '\0'
if attr_char == 'o': if attr_char == 'o':
attrs = [] attrs = []
elif attr_char == 'u': elif attr_char == 'u':