Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'base.': 0.05; 'plenty': 0.07; 'assumed': 0.09; 'exist,': 0.09; 'integers': 0.09; 'assume': 0.14; "(it's": 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'hexadecimal': 0.16; 'internally': 0.16; 'literals*': 0.16; 'literals.': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'pcs,': 0.16; 'received:192.168.1.4': 0.16; 'subject:search': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'bit': 0.19; 'addition,': 0.20; '>>>': 0.22; 'memory': 0.22; 'example': 0.22; 'programming': 0.22; 'saying': 0.22; 'header:User-Agent:1': 0.23; 'bytes': 0.24; 'integer': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'chris': 0.29; 'am,': 0.29; "i'm": 0.30; 'work.': 0.31; 'usually': 0.31; 'division': 0.31; 'probably': 0.32; 'languages': 0.32; "i'd": 0.34; 'could': 0.34; 'operations': 0.35; 'there': 0.35; 'curious': 0.36; 'ibm': 0.36; "didn't": 0.36; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; 'how': 0.40; "you're": 0.61; 'default': 0.69; 'computers': 0.72; '2015': 0.84; 'actually,': 0.84; 'dozens': 0.84; 'subject:find': 0.84; 'edwards': 0.91; 'subject:Best': 0.91; 'hundred': 0.95; 'philip': 0.95 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=DZWZq5dW c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=SY9aFQKHIdAA:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=pGLkceISAAAA:8 a=a7uA6vp0Ez4vVwdYawoA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett@:2500 Date: Tue, 07 Apr 2015 17:02:20 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Best search algorithm to find condition within a range References: <2e3a3c01-20b3-4948-9b32-bd80ed46822b@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1428422544 news.xs4all.nl 2949 [2001:888:2000:d::a6]:42944 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88601 On 2015-04-07 16:05, Grant Edwards wrote: > On 2015-04-07, Chris Angelico wrote: >> On Wed, Apr 8, 2015 at 12:36 AM, wrote: >> >>> Integers are internally assumed to be base 10 otherwise you could not >>> calculate without giving the base. >>> >>> All operations on integers addition, subtraction, multiplication and >>> division assume base 10. >> >> You misunderstand how computers and programming languages work. What >> you're seeing there is that *integer literals* are usually in base >> 10; and actually, I can point to plenty of assembly languages where >> the default isn't base 10 (it's usually base 16 (hexadecimal) on IBM >> PCs, and probably base 8 (octal) on big iron). > > I'd be curious to see some of those assemblers. I've used dozens of > assemblers over the years for everything from microprocessors with a > few hundred bytes of memory to mini-computers and mainframes. I've > never seen one that didn't default to base 10 for integer literals. > > I'm not saying they don't exist, just that it would be interesting to > see an example of one. > I have a book called "Choosing and using 4 Bit Microcontrollers" by Philip McDowell. In it is an example assembly listing for an OKI 6351 microcontroller that uses unadorned hexadecimal literals.