Re: surprise - byte in set

2015-01-05 Thread Amir Arsalan
Hi my friends. On last result you have a , b , c binary. >> set('abc') {'a','b','c') >> set(b'abc') {97,98,99} On Jan 3, 2015 10:25 PM, "patrick vrijlandt" wrote: > 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 ...

Re: surprise - byte in set

2015-01-03 Thread patrick vrijlandt
Dear all, Many thanks for your responses. I never realised this difference between 'bytes' and 'string'. Thanks, Patrick --- Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list

Re: surprise - byte in set

2015-01-03 Thread Gary Herron
On 01/03/2015 10:50 AM, patrick vrijlandt wrote: 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 >>>

Re: surprise - byte in set

2015-01-03 Thread Dan Stromberg
On Sat, Jan 3, 2015 at 10:50 AM, patrick vrijlandt wrote: > 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 ... In the last case, the set has integers in it. Try: b'b'[0] in set(b'abc') -- https://mail.python.org/mail

Re: surprise - byte in set

2015-01-03 Thread Jason Friedman
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 w

surprise - byte in set

2015-01-03 Thread patrick vrijlandt
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 >>