c[:]()

Carsten Haese carsten at uniqsys.com
Wed May 30 15:54:32 EDT 2007


On Wed, 2007-05-30 at 11:48 -0700, Warren Stringer wrote:
> I want to call every object in a tupple, like so:
> 
> #------------------------------------------
> def a: print 'a'
> def b: print 'b'
> c = (a,b) 
> 
> >>>c[:]()  # i wanna
> [...]
> Is there something obvious that I'm missing?

Yes: Python is not Perl.

Python is based on the principle that programmers don't write computer
code for the benefit of the computer, but for the benefit of any
programmer who has to read their code in the future. Terseness is not a
virtue. To call every function in a tuple, do the obvious:

for func in funcs: func()

HTH,

-- 
Carsten Haese
http://informixdb.sourceforge.net





More information about the Python-list mailing list