script question

Aahz aahz at pythoncraft.com
Fri Apr 17 10:03:18 EDT 2009


In article <m263h3vadt.fsf at cs.uu.nl>, Piet van Oostrum  <piet at cs.uu.nl> wrote:
>
>Others have suggested getattr. I think a cleaner (more pythonic) way
>would be: 
>
>funclist = [func01, func02, func03, ... ]
>for i in range(1,n):
>    funclist[i]()

Go to all that trouble, you might as well make it easier:

for func in funclist:
    func()
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair



More information about the Python-list mailing list