c[:]()

Sion Arrowsmith siona at chiark.greenend.org.uk
Fri Jun 1 10:07:07 EDT 2007


Warren Stringer <warren at muse.com> wrote:
>#--------------------------------------
>class do(list):
>    def __call__(self,*args,**kwargs):
>        return [f(*args,**kwargs) for f in self]
>        
>
>def a(): print 'a called'
>def b(): print 'b called'
>c = do()
>c = [a,b]
>do(c[:])() 
>do(c)()    
>#--------------------------------------
>
>I prefer that last line, because [:] is very expensive to type from a cell
>phone. 

And not because it's completely redundant?

>Now, if I could only could do this:
>
>	do(orchestra(conductor)).play() 

Something along the lines of:
    def __getattr__(self, name):
        return do(getattr(x, name) for x in self)
?

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list