\'Hello \' + (\'there\' if name is None else name)
Is the equivalent of
msg = \'Hello \' if name is None: msg += \'there\' else:
Use a dictionary to perform a mapping:
srepr = "'Modify " + {"p": "Pointer", "v": "value"}.get(self.register, "Unknown")
(by the way, instead of '\'...' you can use "'... for a bit more clarity.
'\'...'
"'...