Re: [Tutor] iter class

2014-01-23 Thread eryksun
On Thu, Jan 23, 2014 at 7:43 PM, Steven D'Aprano wrote: > Generators are a kind of function, which are special. You can't inherit > from them: I clarified my sloppy language in a reply. `__iter__` should be a generator function, not a generator. A generator function uses `yield` and `yield from`

Re: [Tutor] iter class

2014-01-23 Thread Steven D'Aprano
On Thu, Jan 23, 2014 at 02:24:20PM -0500, Keith Winston wrote: > On Thu, Jan 23, 2014 at 7:05 AM, eryksun wrote: > > Generally you'll make `__iter__` a generator, so you don't have to > > worry about implementing `__next__`. Also, the built-in function > > `next` was added in 2.6, so you don't hav

Re: [Tutor] iter class

2014-01-23 Thread Steven D'Aprano
On Thu, Jan 23, 2014 at 02:18:33PM -0500, Keith Winston wrote: > On Thu, Jan 23, 2014 at 1:36 PM, Devin Jeanpierre > wrote: > > > Again, nothing was incorrect about the example. Every iterator has > > this "problem". > > Hmmm. Well, here's what he actually said about that example, since I > don'

Re: [Tutor] iter class

2014-01-23 Thread eryksun
On Thu, Jan 23, 2014 at 2:24 PM, Keith Winston wrote: > On Thu, Jan 23, 2014 at 7:05 AM, eryksun wrote: >> Generally you'll make `__iter__` a generator, so you don't have to >> worry about implementing `__next__`. Also, the built-in function >> `next` was added in 2.6, so you don't have to worry

Re: [Tutor] iter class

2014-01-23 Thread Keith Winston
On Thu, Jan 23, 2014 at 7:05 AM, eryksun wrote: > Generally you'll make `__iter__` a generator, so you don't have to > worry about implementing `__next__`. Also, the built-in function > `next` was added in 2.6, so you don't have to worry about the method > name difference between 2.x and 3.x, eith

Re: [Tutor] iter class

2014-01-23 Thread Keith Winston
On Thu, Jan 23, 2014 at 1:36 PM, Devin Jeanpierre wrote: > Again, nothing was incorrect about the example. Every iterator has > this "problem". Hmmm. Well, here's what he actually said about that example, since I don't think I've explained correctly: * With iterators, one thing to watch out

Re: [Tutor] iter class

2014-01-23 Thread Devin Jeanpierre
On Thu, Jan 23, 2014 at 7:50 AM, Keith Winston wrote: > Yes, the exercise was about implementing an iter incorrectly, to see > the difference. But I don't really understand your second point: when > I changed the method name, it worked...? Again, nothing was incorrect about the example. Every ite

Re: [Tutor] iter class

2014-01-23 Thread eryksun
On Thu, Jan 23, 2014 at 10:50 AM, Keith Winston wrote: > On Thu, Jan 23, 2014 at 7:05 AM, eryksun wrote: >> Generally you'll make `__iter__` a generator, so you don't have to >> worry about implementing `__next__`. Also, the built-in function >> `next` was added in 2.6, so you don't have to worry

Re: [Tutor] iter class

2014-01-23 Thread Keith Winston
On Thu, Jan 23, 2014 at 7:05 AM, eryksun wrote: > Generally you'll make `__iter__` a generator, so you don't have to > worry about implementing `__next__`. Also, the built-in function > `next` was added in 2.6, so you don't have to worry about the method > name difference between 2.x and 3.x, eith

Re: [Tutor] iter class

2014-01-23 Thread Keith Winston
On Thu, Jan 23, 2014 at 3:09 AM, Peter Otten <__pete...@web.de> wrote: > But why not install Python 2.7 on your machine, too? That would allow you > run the examples as is. Y'know, it's funny, but I have 2.7 installed. But since I was almost certain it was a 2to3 kind of problem, I wanted to figur

Re: [Tutor] iter class

2014-01-23 Thread Keith Winston
On Thu, Jan 23, 2014 at 5:56 AM, spir wrote: > Yes, but that way others learn as well :-) And many people prefere learning > via human interaction then dealing with arid texts Well, you caught me. I do run out of steam just plowing through lessons & such: it really helps to have actual humans to

Re: [Tutor] iter class

2014-01-23 Thread eryksun
On Thu, Jan 23, 2014 at 12:53 AM, Keith Winston wrote: >> in Python 3, it should be __next__, not next. > > Ah! That's it! Thanks!!! Generally you'll make `__iter__` a generator, so you don't have to worry about implementing `__next__`. Also, the built-in function `next` was added in 2.6, so you

Re: [Tutor] downloading Python

2014-01-23 Thread David
On 23 January 2014 11:27, Mackenzi Jackson wrote: > Hi there, I'm new to computers in general but I'd like to start programming > asap. I'm having trouble getting Python to run on my computer. Is this the > right place to seek help? If so, my mac is OS x 10.6.8 and I was trying to > run Mac Python

Re: [Tutor] iter class

2014-01-23 Thread spir
On 01/23/2014 06:53 AM, Keith Winston wrote: I suppose I should practice running my questions on old code through 2to3 before I pester the Tutor list, since that's probably also a good way to learn the differences. Yes, but that way others learn as well :-) And many people prefere learning via

Re: [Tutor] downloading Python

2014-01-23 Thread Alan Gauld
On 23/01/14 00:27, Mackenzi Jackson wrote: programming asap. I'm having trouble getting Python to run on my computer. Is this the right place to seek help? If so, my mac is OS x 10.6.8 and I was trying to run Mac Python 2.3.3 (I think). I've been trying for a few hours now and am getting very fr

Re: [Tutor] downloading Python

2014-01-23 Thread Danny Yoo
Hi Mackenzi, My understanding is that all Mac OS X computers have Python installed by default. You mentioned that you were starting to learn computers. Do you have some familiarity with Terminal? If so, try 'python' at your terminal. If not, you probably want a GUI environment to make things m

Re: [Tutor] downloading Python

2014-01-23 Thread Mark Lawrence
On 23/01/2014 00:27, Mackenzi Jackson wrote: Hi there, I'm new to computers in general but I'd like to start programming asap. I'm having trouble getting Python to run on my computer. Is this the right place to seek help? If so, my mac is OS x 10.6.8 and I was trying to run Mac Python 2.3.3 (I th

[Tutor] downloading Python

2014-01-23 Thread Mackenzi Jackson
Hi there, I'm new to computers in general but I'd like to start programming asap. I'm having trouble getting Python to run on my computer. Is this the right place to seek help? If so, my mac is OS x 10.6.8 and I was trying to run Mac Python 2.3.3 (I think). I've been trying for a few hours now and

Re: [Tutor] iter class

2014-01-23 Thread Peter Otten
Keith Winston wrote: > On Thu, Jan 23, 2014 at 12:21 AM, Devin Jeanpierre > wrote: >> in Python 3, it should be __next__, not next. > > Ah! That's it! Thanks!!! > >> I'd suggest staying away from any old blog posts and articles, unless >> you'd care to learn Python 2.x instead of 3.x. ;) > > Y