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

Masklinn masklinn at masklinn.net
Wed Jul 18 20:16:18 CEST 2012


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).

So Python strings don't have reified characters, a string's item and a
slice of size 1 are essentially identical which is pretty much unique
to them (as far as my knowledge of Python's sequences go).

Which is not a bad thing, mind you, it makes working with strings much
more pleasant.



More information about the Python-ideas mailing list