On 10 February 2013 14:32, Walter Prins wrote:
[snip
>
> This worked mostly fine, however yesterday I ran into a slightly unexpected
> problem when I found that when the list contents is iterated over and values
> retrieved that way rather than via [], then __getitem__ is in fact *not*
> called on
Peter Otten wrote:
> def __iter__(self):
> for i in range(len(self)):
> return self[i]
That should of course be 'yield', not 'return'
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.pytho
On 02/10/2013 10:10 AM, Dave Angel wrote:
On 02/10/2013 09:32 AM, Walter Prins wrote:
Hello,
I have a program where I'm overriding the retrieval of items from a list.
As background: The data held by the lists are calculated but then read
potentially many times thereafter, so in order to preve
Walter Prins wrote:
> Hello,
>
> I have a program where I'm overriding the retrieval of items from a list.
> As background: The data held by the lists are calculated but then read
> potentially many times thereafter, so in order to prevent needless
> re-calculating the same value over and over,
On 11/02/13 01:32, Walter Prins wrote:
Hello,
I have a program where I'm overriding the retrieval of items from a list.
As background:
[...snip interesting but irrelevant background...]
Here's a test application that demonstrates the issue:
[...snip overly complicated application...]
Her
On 02/10/2013 09:32 AM, Walter Prins wrote:
Hello,
I have a program where I'm overriding the retrieval of items from a list.
As background: The data held by the lists are calculated but then read
potentially many times thereafter, so in order to prevent needless
re-calculating the same value o