[Chicago] AttributeError on implementation of high order functions

Randall Baxley rlbax777 at swbell.net
Tue Nov 6 10:59:29 CET 2012


I thought there might be something to learn if indeed add caused it to throw an error for append.
Randy

--- On Mon, 11/5/12, Raghavan <itsrag at gmail.com> wrote:

From: Raghavan <itsrag at gmail.com>
Subject: Re: [Chicago] AttributeError on implementation of high order functions
To: "The Chicago Python Users Group" <chicago at python.org>
Date: Monday, November 5, 2012, 11:54 PM

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




-----Inline Attachment Follows-----

_______________________________________________
Chicago mailing list
Chicago at python.org
http://mail.python.org/mailman/listinfo/chicago
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20121106/8d1b425c/attachment.html>


More information about the Chicago mailing list