[Chicago] AttributeError on implementation of high order functions

Raghavan itsrag at gmail.com
Tue Nov 6 02:42:47 CET 2012


I am trying to implement a mapstream
class MapStream(Stream):
    def __init__(self, fn, stream):
        super(MapStream, self).__init__()
        self.fn = fn
        self.stream = stream

    def popNext(self):
        val = self.stream.popNext()
        return self.fn(val)

    def popN(self,num_N):
        n_poped_list = ()
        while num_N:
          *n_poped_list.add(self.popNext()) #Error line*
            num_N -= 1
        return n_poped_list


The popN function is throwing an error stating "*AttributeError: 'tuple'
object has no attribute 'append'*" in the underlined line above.

Please help me out to figure out this issue.

-- 
Thanks and Regards,
Raghavan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20121105/b3422c98/attachment.html>


More information about the Chicago mailing list