Re: [Tutor] FrozenDict

2015-10-08 Thread eryksun
On 10/8/15, Steven D'Aprano wrote: > > That's one solution, but it is certainly possible for the class to be > its own iterator, in which case it needs to follow two rules: > > (1) self.__next__() needs to return the next value, or raise > StopIteration; > > (2) self.__iter__() needs to return sel

Re: [Tutor] FrozenDict

2015-10-08 Thread Steven D'Aprano
On Thu, Oct 08, 2015 at 12:03:28PM +0100, Oscar Benjamin wrote: > On 8 October 2015 at 01:47, Steven D'Aprano wrote: > > In 3.3, you will have a problem that FrozenDict is not a proper > > iterator. You can't set self.__next__ = self.next, that won't work. > > Dunder methods have to be on the clas

Re: [Tutor] Updating index of a list

2015-10-08 Thread Alan Gauld
On 08/10/15 23:17, Alan Gauld wrote: On 08/10/15 20:40, Andrea Nguy wrote: What’s happening is that I am trying to take a list of a list as such: [['1', ' james', ' 1', ' 90'], ['2', ' alice', ' 1', ' 95'], ['5', ' jorgen', ' 1', ' 99’]] (it continues) from a text file. When you say from

Re: [Tutor] Updating index of a list

2015-10-08 Thread Steven D'Aprano
Hi Andrea, and welcome. My responses inline, below. On Thu, Oct 08, 2015 at 03:40:38PM -0400, Andrea Nguy wrote: > Hi there, > > I’m trying to learn some Python programming on my own. What’s > happening is that I am trying to take a list of a list as such: [['1', > ' james', ' 1', ' 90'], ['

Re: [Tutor] Updating index of a list

2015-10-08 Thread Alan Gauld
On 08/10/15 20:40, Andrea Nguy wrote: What’s happening is that I am trying to take a list of a list as such: [['1', ' james', ' 1', ' 90'], ['2', ' alice', ' 1', ' 95'], ['5', ' jorgen', ' 1', ' 99’]] (it continues) from a text file. When you say from a text file, do you mean you are readin

Re: [Tutor] Updating index of a list

2015-10-08 Thread Emile van Sebille
On 10/8/2015 12:40 PM, Andrea Nguy wrote: Hi there, I’m trying to learn some Python programming on my own. What’s happening is that I am trying to take a list of a list as such: [['1', ' james', ' 1', ' 90'], ['2', ' alice', ' 1', ' 95'], ['5', ' jorgen', ' 1', ' 99’]] (it continues) from a

[Tutor] Updating index of a list

2015-10-08 Thread Andrea Nguy
Hi there, I’m trying to learn some Python programming on my own. What’s happening is that I am trying to take a list of a list as such: [['1', ' james', ' 1', ' 90'], ['2', ' alice', ' 1', ' 95'], ['5', ' jorgen', ' 1', ' 99’]] (it continues) from a text file. However, what I am trying to do t

Re: [Tutor] FrozenDict

2015-10-08 Thread Oscar Benjamin
On 8 October 2015 at 01:47, Steven D'Aprano wrote: > In 3.3, you will have a problem that FrozenDict is not a proper > iterator. You can't set self.__next__ = self.next, that won't work. > Dunder methods have to be on the class, not on the instance, so instead > of making the assignment in the __i