Message from discussion
For Counter Variable
Received: by 10.180.91.231 with SMTP id ch7mr2790358wib.1.1348559934857;
Tue, 25 Sep 2012 00:58:54 -0700 (PDT)
Path: ed8ni50854257wib.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path: <python-python-l...@m.gmane.org>
X-Original-To: python-l...@python.org
Delivered-To: python-l...@mail.python.org
X-Spam-Status: OK 0.009
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; 'python':
0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09;
'received:gmane.org': 0.09; 'received:list': 0.09; 'sep': 0.09;
'language': 0.14; 'java.': 0.16; 're-written': 0.16;
'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16;
'skipped': 0.16; 'wrote:': 0.17; 'directory.': 0.17; 'duplicate':
0.17; 'shell': 0.18; 'either.': 0.22; 'programming': 0.23;
'linux': 0.24; 'machine': 0.24; 'script': 0.24; 'header:In-Reply-
To:1': 0.25; 'header:User-Agent:1': 0.26; 'wrote': 0.26;
'opposed': 0.27; 'header:X-Complaints-To:1': 0.28; 'lines': 0.28;
'environment': 0.29; 'concise': 0.29; "d'aprano": 0.29; 'piece':
0.29; 'steven': 0.29; 'code': 0.31; 'from:addr:yahoo.co.uk': 0.32;
'getting': 0.33; '+0200,': 0.33; 'to:addr:python-list': 0.33;
'presence': 0.33; 'version': 0.34; 'something': 0.35;
'received:org': 0.36; 'but': 0.36; 'subject:: ': 0.38; 'mark':
0.38; 'files': 0.38; 'easier': 0.38; 'to:addr:python.org': 0.39;
'header:Received:5': 0.40; 'first': 0.61; 'relatively': 0.62;
'thomas': 0.62; 'more': 0.63; 'soon': 0.70; 'saw': 0.75;
'subject:For': 0.75; 'badly,': 0.84; 'rachel': 0.84; 'reminds':
0.84; 'sides.': 0.84; 'wheel': 0.84
X-Injected-Via-Gmane: http://gmane.org/
To: python-l...@python.org
From: Mark Lawrence <breamore...@yahoo.co.uk>
Subject: Re: For Counter Variable
Date: Tue, 25 Sep 2012 08:59:23 +0100
References: <10965867-a44f-4146-aea2-fd1a1e8f8e3b@googlegroups.com>
<a73d266f-fc5c-415f-8793-0078ab2436e7@googlegroups.com>
<5060DA00.10...@stoneleaf.us>
<CA+vVgJWskC=YOQOX4egcup_9ZvbadOW8BOTuqT7ZTYYW9ev...@mail.gmail.com>
<CAN1F8qV2WDCXsmOPvuHsv0Ox-Q8kBnWbcZ2bf4RxFPpMfK9...@mail.gmail.com>
<CA+vVgJXScfD3BfphCufeLzVnW_yeoCZaZBDN1Q0RMVUmxTY...@mail.gmail.com>
<mailman.1242.1348529944.27098.python-l...@python.org>
<k3rgtq$qt...@r03.glglgl.gl>
<50616157$0$29997$c3e8da3$54964...@news.astraweb.com>
Mime-Version: 1.0
X-Gmane-NNTP-Posting-Host: host-78-147-20-3.as13285.net
User-Agent: Mozilla/5.0 (Windows NT 6.0;
rv:15.0) Gecko/20120907 Thunderbird/15.0.1
In-Reply-To: <50616157$0$29997$c3e8da3$54964...@news.astraweb.com>
X-Antivirus: avast! (VPS 120924-1, 24/09/2012), Outbound message
X-Antivirus-Status: Clean
X-BeenThere: python-l...@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-requ...@python.org?subject=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-l...@python.org>
List-Help: <mailto:python-list-requ...@python.org?subject=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-requ...@python.org?subject=subscribe>
Newsgroups: comp.lang.python
Message-ID: <mailman.1292.1348559933.27098.python-l...@python.org>
Lines: 33
NNTP-Posting-Host: 2001:888:2000:d::a6
X-Trace: 1348559933 news.xs4all.nl 6843 [2001:888:2000:d::a6]:45617
X-Complaints-To: ab...@xs4all.nl
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
On 25/09/2012 08:46, Steven D'Aprano wrote:
> On Tue, 25 Sep 2012 07:53:55 +0200, Thomas Rachel wrote:
>
>> When learning Python, it often happend me to re-inven the wheel. But as
>> soon as I saw the presence of something I re-wrote, I skipped my
>> re-written version and used the built-in.
>
> And me.
>
> Not just Python either. The very first piece of code I wrote on a Linux
> machine was a shell script that (very badly, and even more very slowly)
> counted the number of files in a directory. 20 lines (if I remember
> correctly) to duplicate a simple:
>
> ls | wc -l
>
>
> It was a humbling lesson to always check what features a programming
> environment or language offers before reinventing the wheel with four
> sides.
>
>
>
Thankfully easier in a relatively concise language like Python as
opposed to (say) Java. Which reminds me, in what version of Python are
we getting the singletonMap? :)
--
Cheers.
Mark Lawrence.