I expect that the problem here is that you are attempting to iterate over the
method itself, rather than its result. You'd need to call the method to do
that:
for c in mytrie.items():
print c
hth
c
On Aug 29, 2013, at 4:38 PM, Maria McKinley wrote:
> Hello,
>
> I hope someone on this list doesn't mind answering what I think is a quick
> question. I have been playing around with the python code found here:
>
> http://en.wikipedia.org/wiki/Trie#A_Python_version
>
> I can't get the iterator to work, and I wonder if I'm not calling it
> correctly. I thought once I made my object, and added stuff to it, I could
> just do this:
>
> for c in mytrie.items:
> print c
>
> but I get this error:
>
> TypeError: 'instancemethod' object is not iterable
>
> What am I doing wrong?
>
> thanks,
> Maria
Cris Ewing
--------------------------------------------------
Principal, Cris Ewing, Developer LLC
http://www.crisewing.com
[email protected]
1.206.724.2112