Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder.news-service.com!news2.euro.net!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.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'disagree': 0.07; 'integer,': 0.09; 'broken': 0.12; 'stored': 0.13; 'wrote:': 0.15; 'entirely.': 0.16; 'finney': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'imho,': 0.16; 'integer.': 0.16; 'subject:Convert': 0.16; "subject:' ": 0.16; 'pm,': 0.16; 'received:209.85.210.174': 0.19; 'received:mail- iy0-f174.google.com': 0.19; 'string,': 0.19; 'header:In-Reply- To:1': 0.22; 'equally': 0.23; 'worked': 0.24; 'writes:': 0.25; 'saying': 0.26; 'string': 0.26; "i'm": 0.27; 'message- id:@mail.gmail.com': 0.28; 'server': 0.29; '24,': 0.29; 'sun,': 0.30; 'chris': 0.32; "what's": 0.33; "i've": 0.33; 'to:addr :python-list': 0.34; 'integer': 0.35; 'here,': 0.35; 'with.': 0.36; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'might': 0.39; 'received:209': 0.40; 'sense': 0.40; 'according': 0.63; 'skip:1 10': 0.66; 'validate': 0.67; 'evaluate': 0.71; 'introduce': 0.79; 'dead': 0.80; 'horse': 0.84; 'milliseconds': 0.84; 'ridiculously': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ULAcVV/0XYxZElLsfZ/GTefmdzuSt5cuzwIWktu7mDY=; b=OEfxqvKjd4jSq+bRMh1xbr/NBBwfxbGoCZ6F8sjkFYufUH0REcy8J31IKDji/8EvvP Q6Gy/zktc+A2s07cpQPrxuToqew89etA54gs/apU7p9mUCWNM5DagcaS2keRUP+RwG8s 9hguCFqAEod7gcEGPbfMaUaSKf6J/NB6wct/g= MIME-Version: 1.0 In-Reply-To: <874o2crrex.fsf@benfinney.id.au> References: <4e281f97$0$16404$426a74cc@news.free.fr> <4230ed8b-5173-4408-938f-3777dcd60588@t7g2000vbv.googlegroups.com> <3d6b3ab4-6682-4e33-ab03-098d2f82c20d@o18g2000yqm.googlegroups.com> <58cdafad-e1ea-4774-984f-aa13cf2a9ef1@fq4g2000vbb.googlegroups.com> <874o2crrex.fsf@benfinney.id.au> Date: Sun, 24 Jul 2011 19:42:50 +1000 Subject: Re: Convert '165.0' to int From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311500574 news.xs4all.nl 23877 [2001:888:2000:d::a6]:44684 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10202 On Sun, Jul 24, 2011 at 6:53 PM, Ben Finney wrote: > Frank Millman writes: > >> I know I am flogging a dead horse here, but IMHO, '165', '165.', >> '165.0', and '165.00' are all valid string representations of the >> integer 165.[1] > > I disagree entirely. Once you introduce a decimal point into the > representation, you're no longer representing an integer. > > (They might be the same *number*, but that's not saying the same thing.) What's more, 1.311500322e+12 is a valid representation of a date/time, according to a ridiculously broken game server I've worked with. That's the number of milliseconds since 1970, stored as floating point. I'm sure this makes sense to somebody... Not all possible representations are equally sane. I'm with Ben; '165.00' is not a string representation of an integer - but you CAN take that string, validate it as representing a number that can be represented as an integer, and evaluate what integer it is. Chris Angelico