In <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > On 30 , 22:48, "Warren Stringer" <[EMAIL PROTECTED]> 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 >> >> TypeError: 'tupple' object is not callable >> >> >>>c[0]() # expected >> a >> >>>c[:][0] # huh? >> a >> >>> [i() for i in c] # too long and ...huh? >> >> a >> b >> [None,None] >> #------------------------------------------ >> >> bla-bla-bla...... > > > you can write: >>>> map(lambda x: x(), c) > > I think that it is good idea to use "map()" function for doing > somethimg with each element of a sequence, if the order of a actions > not important. > > it is easy to read and understandable.
And has the same issue as a list comprehension if all you want is the side effect of the calls: a useless temporary list full of `None`\s is build. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list