有没有办法在具有多个属性的用户定义 Python 对象列表上迭代和调用函数?假设它名为Entry,具有属性名称和年龄。
这样我可以说一些大意的东西
def func(name, age):
//do something
def start(list_of_entries)
map(func, list_of_entries.name(), list_of_entries.age())
//but obviously the .name and .age of the object, not the iterable
//these are the only two attributes of the class
正在考虑使用 functools.partial() 但不确定在这种情况下是否有效。