Hacker News new | ask | show | jobs
by akubera 1450 days ago
Isn't that what they ended up doing in Python3?

  $ python2
  >>> "abc" + b"123"
  'abc123'
  >>> "abc" + u"123"
  u'abc123'


  $ python3
  >>> "abc" + b"123" 
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: can only concatenate str (not "bytes") to str
  >>> "abc" + u"123"
  'abc123'
  >>> type(u"123")
  <class 'str'>

P.S. Your use of the word "simply" there is a reminder of how easy it is to underestimate the complexity of handling encoding properly, since it took years (a decade?) to port libraries from Py2 to Py3, since it doesn't just affect string literals, but general IO when reading from files and sockets.