• Kirill Smelkov's avatar
    golang_str: Implement bstr/ustr constructors · 781802d4
    Kirill Smelkov authored
    Both bstr and ustr constructors mimic constructor of unicode(= str on py3) -
    an object is either stringified, or decoded if it provides buffer
    interface, or the constructor is invoked with optional encoding and
    errors argument:
    
        # py2
        class unicode(basestring)
         |  unicode(object='') -> unicode object
         |  unicode(string[, encoding[, errors]]) -> unicode object
    
        # py3
        class str(object)
         |  str(object='') -> str
         |  str(bytes_or_buffer[, encoding[, errors]]) -> str
    
    Stringification of all bstr/ustr / unicode/bytes is handled
    automatically with the meaning to convert to created type via b or u.
    
    We follow unicode semantic for both ustr _and_ bstr, because bstr/ustr
    are intended to be used as strings.
    781802d4
README.rst 19.1 KB