Hi, While it may shock you, using bytes for "text" makes sense in some areas. Please read the Motivation of the PEP 461: https://www.python.org/dev/peps/pep-0461/#motivation
Victor 2017-11-21 15:37 GMT+01:00 Kirill Balunov <kirillbalu...@gmail.com>: > Currently, __repr__ and __str__ representation of bytes is the same. Perhaps > it is worth making them different, this will make it easier to visually > perceive them as a container of integers from 0 to 255, > instead of a mixture of printable and non-printable ascii characters. It is > proposed: > > a) __str__ - leave unchanged > b) __repr__ - represent as sequence of escaped hex > >>>> a = bytes([42,43,44,45,46]) >>>> a # Current > b'*+-./' >>>> a # Proposed > b'\x2a\x2b\x2d\x2e\x2f' > > As you can see, the second example is more easily perceived as a sequence, > in which '\' is also perceived as ',' in list or tuple. In addition, 2020 is > close, it allows the new Pythonistas not to take them as an ascii mixture > strings. > > With kind regards, -gdg > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/