surprise - byte in set

patrick vrijlandt pvrijlandt at gmail.com
Sat Jan 3 13:50:56 EST 2015


Hello list,

Let me first wish you all the best in 2015!

Today I was trying to test for occurrence of a byte in a set ...

 >>> sys.version
'3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 bit 
(Intel)]'
 >>> 'b' in 'abc'
True
 >>> b'b' in b'abc'
True
 >>> 'b' in set('abc')
True
 >>> b'b' in set(b'abc')
False

I was surprised by the last result. What happened?
(Examples simplified; I was planning to manipulate the set)

Patrick

---
Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
http://www.avast.com




More information about the Python-list mailing list