[Python-ideas] '' in 'abc' == True

Steven D'Aprano steve at pearwood.info
Sat Jul 21 13:19:24 CEST 2012


Andrew Svetlov wrote:
> Masklinn's explanation is comprehensive clean to me.

I'm glad that it's clear to someone, because to me the straight-forward, 
literal meaning of Masklinn's explanation (that Python 3 has a character type, 
and they're integers) is wrong. Python has no built-in "Char" type, under any 
spelling, let alone one which is also a subset of int. The non-literal meaning 
is hard to understand. I *guess* that Masklinn is trying to get across that 
Python 3 strings are Unicode strings, and characters in Unicode are actually 
code points, which are implemented at the C level as integers. If not that, I 
have no idea.

I've more or less forgotten why this was important, but I am enjoying watching 
people try to out-pedant each other :)



> On Fri, Jul 20, 2012 at 11:56 PM, Georg Brandl <g.brandl at gmx.net> wrote:
>> On 07/18/2012 09:32 PM, Ethan Furman wrote:
>>> Masklinn wrote:
>>>> On 2012-07-18, at 20:06 , Devin Jeanpierre wrote:
>>>>> On Wed, Jul 18, 2012 at 1:58 PM, Masklinn <masklinn at masklinn.net> wrote:
>>>>>> A Python string, you may want to note, is a string. Not a sequence of
>>>>>> characters.
>>>>> It's both (with the caveat that, in Python, a character is just a
>>>>> string of length 1).
>>>> That's playing with words, especially comparing strings with Python 3
>>>> binaries which *do* actually have a separate "character" type
>>>> (reified to an integer).
>>> Python 3 does not have a 'character' type; it has 'str' which is made up
>>> of more 'str's, and it has 'byte' which is made up of 'int's (annoyingly).
>> That's what he said.  Could we stop the annoying "but I know it better
>> than you without reading your message" please?



-- 
Steven



More information about the Python-ideas mailing list