[Tutor] ideas for a simple program

Steven D'Aprano steve at pearwood.info
Wed Jan 26 05:36:48 CET 2011


walter weston wrote:
> 
> can I have some good ideas for simple programs

Some more ideas...

Take a built-in Python command, and try to duplicate it in pure Python. 
E.g.:

# Untested.
def my_len(obj):
     # Like Python's len() function, only slower.
     try:
         return obj.__len__()
     except AttributeError:
         n = 0
         try:
             while True:
                 x = obj[n]
                 n += 1
         except IndexError:
             return n



Take a shell command from your operating system, and try to re-write it 
in Python. Or write a useful or fun utility in Python, e.g. I have a 
Python script that runs every night scanning my procmail logs for spam 
which is deleted, it copies the subject line and sender, deletes vowels 
from them, and emails the list to me.

Go to the Python Cookbook and look for bugs or improvements in people's 
recipes. Or come up with your own.

http://code.activestate.com/recipes/langs/python/


Go to the Python bug tracker, and try to fix some of the bugs. Or write 
tests for them. Or documentation.

http://bugs.python.org/




-- 
Steven



More information about the Tutor mailing list