For Counter Variable

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Sep 25 03:59:23 EDT 2012


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.




More information about the Python-list mailing list