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


Groups > comp.lang.python > #37643

Re: using split for a string : error

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <oscar.j.benjamin@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'suppress': 0.07; 'python': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'cc:addr :python-list': 0.10; 'subject:error': 0.11; 'language': 0.14; 'cc:name:python list': 0.16; 'permissive': 0.16; 'personally,': 0.16; 'truncating': 0.16; 'string': 0.17; 'wrote:': 0.17; 'string,': 0.17; 'bit': 0.21; 'cc:2**0': 0.23; "i've": 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'values': 0.26; 'message-id:@mail.gmail.com': 0.27; 'chris': 0.28; 'fine': 0.28; '(unless': 0.29; 'behaviour': 0.29; 'complain': 0.29; 'types.': 0.29; "i'm": 0.29; 'that.': 0.30; 'usually': 0.30; 'subject: : ': 0.30; 'function': 0.30; 'error': 0.30; 'point': 0.31; 'generally': 0.32; 'getting': 0.33; 'anyone': 0.33; "can't": 0.34; 'changed': 0.34; 'received:google.com': 0.34; 'doing': 0.35; 'sometimes': 0.35; 'received:209.85': 0.35; 'really': 0.36; 'but': 0.36; 'too': 0.36; 'being': 0.37; 'why': 0.37; 'received:209': 0.37; 'well.': 0.37; 'subject:: ': 0.38; 'where': 0.40; 'stuck': 0.65; '2013': 0.84; 'front.': 0.84; 'oscar': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=TKBgxdYHUau5kbkn1PyecF6i2BPvM7O1ucaBnQeKLjs=; b=ma2ZZfbE+pZn6w6Fz+Muz5yqI7BkiRbCrQwHq6cQIvUFZOnYx0/PLPV2sJZ5npUqjH WxZHzHbxigy8Da+swObwcXAAieR5QzLwxPWMvlinjResyfmWe2P4ygOHVgM39d5Be2B5 j1sPjoZqK4H3jLkAarcb+qCz/FfYrAb9i9Xq+9Y4H/+lukOO/iEavy7Dut1S5+egNPJA aHXdJHg1LeeUNjBFmNnX2y2EuaZQjXftloFUJpBkrMFV9GC1Huja00v/KC/jLkpubHrS kxjxrQ8IbH2SVlHN9kRDjDdNSCbqxiwvnaa1JQ4K7YnZPKjUmGo6TIKKU3BEAOi7jKWl 7kbg==
MIME-Version 1.0
X-Received by 10.152.111.102 with SMTP id ih6mr3552028lab.20.1359075802095; Thu, 24 Jan 2013 17:03:22 -0800 (PST)
In-Reply-To <CAPTjJmrqD7-x_sG_g-9YFFDanOct6_Grdw374EB69Kxy57LwLQ@mail.gmail.com>
References <CAFqGZRGMXcku_nM_LqPsHpCzqGxF57LOSKwKwoCH+LyhPA8t_A@mail.gmail.com> <CAPTjJmpYi23Lx_4zuX28XURnAeaR-R=0w3e1mn6b0GBMs-O6Aw@mail.gmail.com> <51011822.3020702@tobix.eu> <CAPTjJmrqD7-x_sG_g-9YFFDanOct6_Grdw374EB69Kxy57LwLQ@mail.gmail.com>
Date Fri, 25 Jan 2013 01:03:21 +0000
Subject Re: using split for a string : error
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
To Chris Angelico <rosuav@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Cc Python List <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.1024.1359075803.2939.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1359075803 news.xs4all.nl 6861 [2001:888:2000:d::a6]:42835
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:37643

Show key headers only | View raw


On 24 January 2013 11:35, Chris Angelico <rosuav@gmail.com> wrote:
>
> It's usually fine to have int() complain about any non-numerics in the
> string, but I must confess, I do sometimes yearn for atoi() semantics:
> atoi("123asd") == 123, and atoi("qqq") == 0. I've not seen a
> convenient Python function for doing that. Usually it involves
> manually getting the digits off the front. All I want is to suppress
> the error on finding a non-digit. Oh well.
>

I'm interested to know what the situations are where you want the
behaviour of atoi().

Personally, I consider the int() function too permissive because of
its behaviour in truncating non-integer numeric types. But then that's
because I'm always paranoid that the values of my precious numbers are
being changed without my knowledge. From my vantage point I really
can't see why the ambiguous behaviour of atoi() would actually be
desired by anyone (unless they were stuck using a language that made
string manipulation generally a bit awkward).


Oscar

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


Thread

Re: using split for a string : error Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-25 01:03 +0000
  Re: using split for a string : error Neil Cerutti <neilc@norwich.edu> - 2013-01-25 14:04 +0000
    Re: using split for a string : error Hans Mulder <hansmu@xs4all.nl> - 2013-01-25 15:31 +0100
      Re: using split for a string : error Joel Goldstick <joel.goldstick@gmail.com> - 2013-01-25 09:44 -0500
      Re: using split for a string : error Neil Cerutti <neilc@norwich.edu> - 2013-01-25 15:14 +0000

csiph-web