[Chicago] AttributeError on implementation of high order functions

Raghavan itsrag at gmail.com
Tue Nov 6 06:54:51 CET 2012


Hi Brian,

Thanks I will do so but the error which I have mentioned was rectified by
the change which Carl suggested. I am not sure what you mean by the error
message doesn't correspond to the code snippet which I have posted.

The interpreter pointed out the above marked line number and showed me the
same error message which I have posted.

Thanks.


On Mon, Nov 5, 2012 at 9:16 PM, Brian Curtin <brian at python.org> wrote:

> On Mon, Nov 5, 2012 at 7:42 PM, Raghavan <itsrag at gmail.com> wrote:
> > 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.
>
> Although Carl already answered, make sure you put accurate error
> messages in your questions. That error message couldn't have come from
> that code.
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>



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


More information about the Chicago mailing list