more on "Is this considered black magic?"

Philip Swartzleonard starx at pacbell.net
Mon Dec 3 05:52:17 EST 2001


Marcin 'Qrczak' Kowalczyk || Mon 03 Dec 2001 02:04:46a:

> Mon, 03 Dec 2001 10:21:32 +0100, Beda Kosata <kosatab at vscht.cz> pisze:
> 
>> map( lambda o: o.method( args), objects)
>> 
>> The solution is not very error prone, but when you know what you have
>> in your list it works just fine. As a side effect you also get list of
>> results. 
> 
> If you don't need the results, a 'for' loop is more straightforward:
> 
> for i in objects: o.method(args)
> 

Hm, is there something sane that can be done to make 'method' in this 
situation a variable? The way i'm designing things, it would be useful to 
have a 'call ArbitrayFunction of all X in container' function. Pointers to 
established information appriciated, btw :)

-- 
Philip Sw "Starweaver" [rasx] :: <nothing>



More information about the Python-list mailing list