functional programming with map()
Marek Baczek Baczyński
imbaczek at poczta.fm
Tue Feb 26 13:07:40 EST 2002
Pete Shinners wyprodukował[ao]?:
> Donnal Walter wrote:
>> But what is the functional equvalent of:
>>
>> for x in items:
>> x.f()
>
> if all "items" are the same class, you could get away with this,
>
> map(class_of_x.f, items)
map(type(x).f, items) solves the problem.
Pozdrawiam,
Baczek
--
Marek Baczyński aka Baczek UIN:57114871 RLU:201791 http://republika.pl/imbaczek
It is better to be a man without a home page than a man with a homepage created
using Microsoft Frontpage.
More information about the Python-list
mailing list