Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: python 2.7 and unicode (one more time) Date: Mon, 24 Nov 2014 09:40:51 +0200 Organization: A noiseless patient Spider Lines: 39 Message-ID: <87oarx11x8.fsf@elektro.pacujo.net> References: <1416491999.209592.193345213.3A6FF9A4@webmail.messagingengine.com> <87ppch8zvx.fsf@elektro.pacujo.net> <87k32p6ow8.fsf@elektro.pacujo.net> <871towik8j.fsf@elektro.pacujo.net> <5470134c$0$12986$c3e8da3$5496439d@news.astraweb.com> <877fyn68m1.fsf@elektro.pacujo.net> <87sih913xe.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="30155"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Up+vpCrX7gs35VpVP/Im/" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:rKWnXcbcDUO/yk1fRXX5t3oelAw= sha1:z9ZcAScPjAJ+0FG7aaGxOKRmeCo= Xref: csiph.com comp.lang.python:81439 Chris Angelico : > Py3's byte strings are still strings, though. Hm. I don't think so. In a plain English sense, maybe, but that kind of usage can lead to confusion. For example, A subscription selects an item of a sequence (string, tuple or list) or mapping (dictionary) object: subscription ::= primary "[" expression_list "]" [...] A string’s items are characters. A character is not a separate data type but a string of exactly one character. The text is probably a bit buggy since it skates over bytes and byte arrays listed as sequences (by ). However, your Python3 implementation would fail if it interpreted bytes objects to be strings in the above paragraph: >>> "abc"[1] 'b' >>> b'abc'[1] 98 The subscription of a *string* evaluates to a *string*. The subscription of a *bytes* object evaluates to a *number*. Marko