Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41671
| Return-Path | <ian.g.kelly@gmail.com> |
|---|---|
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.038 |
| X-Spam-Evidence | '*H*': 0.93; '*S*': 0.00; '21,': 0.07; 'def': 0.10; 'index': 0.13; 'letter:': 0.16; 'wrote:': 0.17; '<': 0.17; 'all,': 0.21; 'subject:problem': 0.22; 'cheers,': 0.23; '>': 0.23; 'header:In-Reply-To:1': 0.25; 'wrote': 0.26; 'message- id:@mail.gmail.com': 0.27; 'skip:& 10': 0.29; 'to:addr:python- list': 0.33; 'code:': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'subject:with': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'more': 0.63; '2013': 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:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=DbA3WjYvaiRcUUPkLdv7PzYtanoeHx7PVswMCXi2gCw=; b=A7o37ounGA6BuOlnyE0gW8d7Z36VGQdl3NmnW2P9irSeJlSauMtnAiPVnF7DHyKIXZ tC/FeFBnZrxNpz0cnjgxP1lMo78ulB+lowlMaJ0cUtknqFFGkddFWlx5y4jfj/eJhqlk 3I8z3tf1UCQtznDTwLDvM7sc0fdpxNwRvHBDwfDbdfUDpCLEERMQkpWuzNwEcvs24Ln4 epcJhB/HSJXnpabbjBzXiqdEasHetFc3BadMfG4hzeWzwEQWNgvhcUap1+t+cDSPniXr 4RuX41IajSofEQVqycTcKmYiPh1gnRvMB5QRQ6U+qsJrxNjAfN68Zp1aGhIQMxR4wpVI ig9g== |
| MIME-Version | 1.0 |
| X-Received | by 10.52.76.103 with SMTP id j7mr13784857vdw.90.1363903466923; Thu, 21 Mar 2013 15:04:26 -0700 (PDT) |
| In-Reply-To | <870147F2-AF34-456A-BDF3-12C0A2F67A69@icloud.com> |
| References | <870147F2-AF34-456A-BDF3-12C0A2F67A69@icloud.com> |
| Date | Thu, 21 Mar 2013 16:04:26 -0600 |
| Subject | Re: problem with function |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| To | Python <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=bcaec5016233a76cea04d8768539 |
| 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.3602.1363903475.2939.python-list@python.org> (permalink) |
| Lines | 59 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1363903475 news.xs4all.nl 6876 [2001:888:2000:d::a6]:58839 |
| X-Complaints-To | abuse@xs4all.nl |
| Path | csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
| Xref | csiph.com comp.lang.python:41671 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Mar 21, 2013 1:35 PM, "leonardo selmi" <l.selmi@icloud.com> wrote:
>
> hi all,
>
> i wrote the following code:
>
> def find(word, letter):
> index = 0
> while index < len(word):
> if word[index] == letter:
> return index
> index = index + 1
> return -1
>
More efficient:
def find(word, letter):
return word.find(letter)
Or even:
find = str.find
Cheers,
Ian
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: problem with function Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-21 16:04 -0600
csiph-web