Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16053
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!198.186.194.249.MISMATCH!transit3.readnews.com!news-out.readnews.com!transit4.readnews.com!panix!not-for-mail |
|---|---|
| From | Grant Edwards <invalid@invalid.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: Non-POSIX parity (mark/space) with Python-Serial on Linux. |
| Date | Mon, 21 Nov 2011 23:08:12 +0000 (UTC) |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 18 |
| Message-ID | <jaelks$e20$1@reader1.panix.com> (permalink) |
| 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> <mailman.2933.1321908148.27778.python-list@python.org> |
| NNTP-Posting-Host | dsl.comtrol.com |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Trace | reader1.panix.com 1321916892 14400 64.122.56.22 (21 Nov 2011 23:08:12 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Mon, 21 Nov 2011 23:08:12 +0000 (UTC) |
| User-Agent | slrn/pre0.9.9-102 (Linux) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:16053 |
Show key headers only | View raw
On 2011-11-21, David Riley <fraveydank@gmail.com> wrote:
> 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).
Like the old joke:
There are 10 kinds of people in the world: those who understand
binary numbers, and those who don't.
--
Grant Edwards grant.b.edwards Yow! ... I don't like FRANK
at SINATRA or his CHILDREN.
gmail.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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