Path: csiph.com!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed6.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; 'strings.': 0.07; 'python': 0.09; 'subject:Python3': 0.09; 'subject:set': 0.09; 'def': 0.10; 'assume': 0.11; 'essential': 0.15; 'oct': 0.16; 'subject:bit': 0.16; 'string': 0.17; 'wrote:': 0.17; 'certainly': 0.17; 'thu,': 0.17; 'solution.': 0.18; 'math': 0.20; 'properties': 0.24; 'header :In-Reply-To:1': 0.25; 'question': 0.27; 'message- id:@mail.gmail.com': 0.27; 'arithmetic': 0.29; 'defeating': 0.29; 'remains': 0.29; 'received:209.85.215.46': 0.30; 'asked': 0.33; 'to:addr:python-list': 0.33; 'operations': 0.33; 'received:google.com': 0.34; 'done': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'problems': 0.36; 'enough': 0.36; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'beat': 0.65; 'neil': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=qUjzFt/Z8Z3nJFW9kU8/w/MBz0kQfNWOgqG1aNFCY0M=; b=MLHvyX6R0Uz3tXjQA3wFvgvAyeAInQ+tBYsAX84ZYTScViBfplw8usePLHUeAsrxj9 ywfx4fBV44sVeD+77T/+kheyzi4HQjnyIrNtEEpY5Hk+WoeKHRJROM8PafL5M1YFg9cJ Rrj1kNq3X6EPgn1SgXaGQclTyBq+eMWNHTBNWZO62OEbh1TTlqmfo+YefAUyd2m7/Bk+ SI05ydXq4ORTVyla3n64a0rUN7PXKkelHw/gIXYJlDAwm48ASRoWgYOvRiz83mUdBwfF OsDeP9fIB1QPR/4FHFeGofQdh+bixCB7eA/rJy8vhTpJt8I/rPC8ECNQ6DetIxsVFD1/ NwZw== MIME-Version: 1.0 In-Reply-To: References: <5089511E.4090009@earthlink.net> <50896152$0$29978$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Thu, 25 Oct 2012 14:20:00 -0600 Subject: Re: bit count or bit set && Python3 To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351196432 news.xs4all.nl 6872 [2001:888:2000:d::a6]:53501 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32160 On Thu, Oct 25, 2012 at 2:00 PM, Neil Cerutti wrote: > Yes indeed! Python string operations are fast enough and its > arithmetic slow enough that I no longer assume I can beat a neat > lexicographical solution. Try defeating the following with > arithmetic: > > def is_palindrom(n): > s = str(n) > return s = s[::-1] Problems like these are fundamentally string problems, not math problems. The question being asked isn't about some essential property of the number, but about its digital representation. Certainly they can be reasoned about mathematically, but the fact remains that the math being done is about the properties of strings.