• Kirill Smelkov's avatar
    golang_str: bstr/ustr repr · 386844d3
    Kirill Smelkov authored
    Teach bstr/ustr to provide repr of themselves: it goes as b(...) and
    u(...) where u stands for human-readable repr of contained data.
    Human-readable means that non-ascii printable unicode characters are
    shown as-is instead of escaping them, for example:
    
        >>> x = u'αβγ'
        >>> x
        'αβγ'
        >>> y = b(x)
        >>> y
        b('αβγ')				<-- NOTE not b(b'\xce\xb1\xce\xb2\xce\xb3')
        >>> x.encode('utf-8')
        b'\xce\xb1\xce\xb2\xce\xb3'
    386844d3
_golang_str.pyx 33.9 KB