Apply `map` over property in python

Viewed 6923

I'd like to map over a property, so I tried

map(lambda o: cls.prop(o), list_of_objects)

The property is defined in an external library as:

@property
def prop(self):

However, I get a TypeError error.

I tested it "unmapped", and cls.prop(an_object) works just fine, as it should be, is equivalent to an_object.prop.

What am I doing wrong? How could I achieve this?

(I'm aware list comprehension [o.prop for o in list_of_objects], but I want to learn and understand what went wrong above).

1 Answers
Related