I am trying to implement a mapstream<div><div>class MapStream(Stream):</div><div> def __init__(self, fn, stream):</div><div> super(MapStream, self).__init__()</div><div> self.fn = fn</div><div> self.stream = stream</div>
<div><br></div><div> def popNext(self):</div><div> val = self.stream.popNext()</div><div> return self.fn(val)</div><div><br></div><div> def popN(self,num_N):</div><div> n_poped_list = ()</div><div>
while num_N:</div><div> <span style="background-color:rgb(238,238,238)"><i><u>n_poped_list.add(self.popNext()) #Error line</u></i></span></div><div> num_N -= 1</div><div> return n_poped_list</div>
<div><br></div><div><br></div><div>The popN function is throwing an error stating "<i>AttributeError: 'tuple' object has no attribute 'append'</i>" in the underlined line above.</div><div><br></div>
<div>Please help me out to figure out this issue.</div><div><br></div>-- <br>Thanks and Regards,<div>Raghavan</div><div><br></div><br>
</div>