Alan Harris-Reid <a...@baselinedata.co.uk> writes: > From what I can gather from the documentation the b prefix represents > a bytes literal
Yes. In Python 3 there are two types with similar-looking literal syntax: ‘str’ and ‘bytes’. The types are mutually incompatible (though they can be explicitly converted). <URL:http://docs.python.org/3.1/library/stdtypes.html#typesseq> <URL:http://docs.python.org/3.1/reference/lexical_analysis.html#strings> > but can anyone explain (in simple english) what this means? It means the difference between “a sequence of bytes” and “a sequence of characters”. The two are not the same, have not ever been the same despite a long history in computing of handwaving the differences, and Python 3 finally makes them unambiguously distinct. A general solution wasn't even feasible for a long time, but now we have Unicode, a mature standard for uniformly representing all the world's writing systems in software. So Python 3 made ‘str’ the Unicode “string of characters” type, and the ‘'foo'’ literal syntax creates objects of this type. The Python 3.1 documentation has a Unicode HOWTO that you should read <URL:http://docs.python.org/3.1/howto/unicode.html>. -- \ “We must respect the other fellow's religion, but only in the | `\ sense and to the extent that we respect his theory that his | _o__) wife is beautiful and his children smart.” —Henry L. Mencken | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list