Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16049

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!txtfeed1.tudelft.nl!tudelft.nl!txtfeed2.tudelft.nl!amsnews11.chello.com!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <fraveydank@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:Python': 0.05; '128': 0.09; '21,': 0.09; 'prefix': 0.09; 'to:addr:comp.lang.python': 0.09; 'binary': 0.13; 'doing,': 0.16; 'hexadecimal': 0.16; 'manipulating': 0.16; 'ordinal': 0.16; '(i.e.': 0.17; 'wrote:': 0.18; '(which': 0.19; '(or': 0.22; 'header:In-Reply-To:1': 0.22; 'received:209.85.212.46': 0.23; 'received:mail-vw0-f46.google.com': 0.23; 'appear': 0.23; 'noticed': 0.24; "i'm": 0.26; 'bit': 0.28; 'assuming': 0.29; 'nov': 0.29; 'pm,': 0.29; 'values': 0.32; 'value.': 0.32; "isn't": 0.33; 'message-id:@gmail.com': 0.33; 'rather': 0.33; 'to:addr :python-list': 0.34; 'received:209.85.212': 0.34; 'to:no real name:2**1': 0.35; 'subject:/': 0.35; 'subject:with': 0.36; 'charset:us-ascii': 0.37; 'but': 0.37; 'received:192': 0.37; 'received:google.com': 0.37; 'another': 0.37; 'not,': 0.37; 'received:209.85': 0.38; 'should': 0.39; 'subject: (': 0.40; "it's": 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'received:192.168': 0.40; 'difference': 0.40; 'to:2**2': 0.61; 'header:Message-Id:1': 0.62; 'number.': 0.66; 'high': 0.67; '128,': 0.84; 'subject:Serial': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=mmJYnD4tsmq6+IRRNuqeHVPQ6JQuLe1iKgwQiIpiaKM=; b=EkoRRIcQHNFNdEtH8OaIolREaRDFD8yRFWAhX0H7hZAlrHN+tXU7kuhNM62DznsHeY CZXSZ4XLS85v9ArgLWWiCfKyylV3mtLob91CIXljhANRPtFXr0sNglCamcD/DF3pOFYi 8eoEb5Tyo5PkfNcTHPXVCRvVwSxIYOPGtJ59g=
Content-Type text/plain; charset=us-ascii
Mime-Version 1.0 (Apple Message framework v1251.1)
Subject Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.
From David Riley <fraveydank@gmail.com>
In-Reply-To <6568831.884.1321903764225.JavaMail.geo-discussion-forums@yqhd1>
Date Mon, 21 Nov 2011 15:42:23 -0500
Content-Transfer-Encoding quoted-printable
References <27511132.925.1321884055247.JavaMail.geo-discussion-forums@yqnf38> <201111211225.54775.gheskett@wdtv.com> <2A18CB23-4EDC-46E9-A49D-DEDE28C7FBEF@gmail.com> <mailman.2925.1321900402.27778.python-list@python.org> <6568831.884.1321903764225.JavaMail.geo-discussion-forums@yqhd1>
To comp.lang.python@googlegroups.com, Matthew Lenz <matthew@nocturnal.org>, python-list@python.org
X-Mailer Apple Mail (2.1251.1)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2933.1321908148.27778.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1321908148 news.xs4all.nl 6865 [2001:888:2000:d::a6]:39890
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16049

Show key headers only | View raw


On Nov 21, 2011, at 2:29 PM, Matthew Lenz wrote:

> Another thing I noticed is that the & and | appear to give the same result as adding or subtracting 128 from the ordinal value.  I'm assuming that isn't coincidence. :)

It's not, though the difference is important.  They're binary ANDs (&) and ORs (|), so (0x0F | 0x80) = 0x8F, but (0x8F | 0x80) = 0x8F as well, whereas (0x8F + 0x80) = 0x10F.  For manipulating bit values (which is what you're doing, you should almost never be adding or subtracting, but rather ANDing and ORing (or XORing, but not nearly as often).

Just in case you're not familiar, 0x is the prefix for a hexadecimal number. 0x80 = 128, which is binary 10000000 (i.e. the high bit in a byte).


- Dave

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Non-POSIX parity (mark/space) with Python-Serial on Linux. mlenz@nocturnal.org - 2011-11-21 06:00 -0800
  Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Matthew Lenz <matthew@nocturnal.org> - 2011-11-21 06:16 -0800
  Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Nizamov Shawkat <nizamov.shawkat@gmail.com> - 2011-11-21 15:26 +0100
    Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Matthew Lenz <matthew@nocturnal.org> - 2011-11-21 08:28 -0800
      Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Chris Angelico <rosuav@gmail.com> - 2011-11-22 03:41 +1100
      Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. David Riley <fraveydank@gmail.com> - 2011-11-21 11:47 -0500
        Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Matthew Lenz <matthew@nocturnal.org> - 2011-11-21 08:52 -0800
        Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Matthew Lenz <matthew@nocturnal.org> - 2011-11-21 08:52 -0800
          Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. David Riley <fraveydank@gmail.com> - 2011-11-21 12:22 -0500
            Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Matthew Lenz <matthew@nocturnal.org> - 2011-11-21 09:59 -0800
            Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Matthew Lenz <matthew@nocturnal.org> - 2011-11-21 09:59 -0800
              Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. David Riley <fraveydank@gmail.com> - 2011-11-21 13:12 -0500
          Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. MRAB <python@mrabarnett.plus.com> - 2011-11-21 18:20 +0000
      Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. gene heskett <gheskett@wdtv.com> - 2011-11-21 12:25 -0500
      Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. David Riley <fraveydank@gmail.com> - 2011-11-21 12:50 -0500
    Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Matthew Lenz <matthew@nocturnal.org> - 2011-11-21 08:28 -0800
  Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. gene heskett <gheskett@wdtv.com> - 2011-11-21 13:33 -0500
    Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Matthew Lenz <matthew@nocturnal.org> - 2011-11-21 11:29 -0800
      Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Grant Edwards <invalid@invalid.invalid> - 2011-11-21 19:42 +0000
    Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Matthew Lenz <matthew@nocturnal.org> - 2011-11-21 11:29 -0800
      Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. David Riley <fraveydank@gmail.com> - 2011-11-21 15:42 -0500
        Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Grant Edwards <invalid@invalid.invalid> - 2011-11-21 23:08 +0000
          Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Grant Edwards <invalid@invalid.invalid> - 2011-11-21 23:09 +0000
            Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. Chris Angelico <rosuav@gmail.com> - 2011-11-22 11:32 +1100

csiph-web