For Counter Variable
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Sep 25 03:46:31 EDT 2012
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.
--
Steven
More information about the Python-list
mailing list