I have a class called Interval for which I want to create multiple interval objects from a list of intervals. How do I do it with map ?
class Interval(object):
def __init__(self, s=0, e=0):
self.start = s
self.end = e
intervals = [[1,2],[3,5],[6,7],[8,10],[12,16]]
I tried to do:
objs = map(Interval, intervals)
But this sends the full interval as the first parameter rather than the inputs to the class individually.
swill get a list as input, andewill be0for all cases...