Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.061 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'subject:set': 0.09; 'jan': 0.12; '>>': 0.16; "'b'": 0.16; 'binary.': 0.16; 'happened?': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'trying': 0.19; 'patrick': 0.19; 'result.': 0.19; '>>>': 0.22; 'email addr:gmail.com>': 0.22; '>>>': 0.24; 'byte': 0.24; '---': 0.24; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'url:mailman': 0.30; 'url:python': 0.33; 'test': 0.35; 'received:google.com': 0.35; 'false': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'list,': 0.38; 'planning': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'first': 0.61; 'today': 0.64; 'wish': 0.70; '2014,': 0.84; '2015': 0.84; 'avast': 0.84; 'have\xc2\xa0': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=w8+ROOexjPFyOxySOtbUjdfw4UGvWzBUwpWN2c0UUdA=; b=ASUcZm/7MEBLMDQNzwZM9BJ1hsGGApuuVn086wTMRAn60Bh8SjmJ4N87KT5sKftdTv kqdr4M0dbTT8Lq9HAACb2R9paCYo+HFbxbH7exFgYO64nYoPjeaOVy5AJU8RjWXhgiHu XfamdR5mjdCR5pzexTbvyDNpVRRj8C8ui57IQTaqYRMe/tnojgMGqXTgAsxncFAHCiB1 zJbI2h1cFpuWnnCrL4AHJxkQuh3gYPIO6S0HKHoQBkJG2gG70t4VZOFTsnv1DfiQ2W8l 7JxL9qgMMRCK+sq1VO89UWKrIZhpxPAdg4UFvq2j7PAFGvZFC4EPWOKT6b4qmuEP2Ohn Dsdw== MIME-Version: 1.0 X-Received: by 10.194.62.235 with SMTP id b11mr84832002wjs.73.1420312122921; Sat, 03 Jan 2015 11:08:42 -0800 (PST) In-Reply-To: References: <54a83a19$0$6953$e4fe514c@dreader36.news.xs4all.nl> Date: Sat, 3 Jan 2015 22:38:42 +0330 Subject: Re: surprise - byte in set From: Amir Arsalan To: python-list@python.org Content-Type: multipart/alternative; boundary=047d7ba96ed88e97a0050bc42fa2 X-Mailman-Approved-At: Mon, 05 Jan 2015 13:06:12 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 93 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1420459573 news.xs4all.nl 2896 [2001:888:2000:d::a6]:60787 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:83233 --047d7ba96ed88e97a0050bc42fa2 Content-Type: text/plain; charset=UTF-8 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 ... > > >>> 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 > > -- > https://mail.python.org/mailman/listinfo/python-list > --047d7ba96ed88e97a0050bc42fa2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi my friends.

On last result you have=C2=A0 a , b , c=C2=A0 binary.

>> set('abc')
{'a','b','c')
>> set(b'abc')
{97,98,99}

On Jan 3, 2015 10:25 PM, "patrick vrijlandt= " <pvrijl= andt@gmail.com> 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=C2=A0 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=

--
https://mail.python.org/mailman/listinfo/python-list
--047d7ba96ed88e97a0050bc42fa2--