Re: [Tutor] iter class

2014-01-22 Thread Keith Winston
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. ;) Yeah, but this is a REALLY GOOD resource

Re: [Tutor] iter class

2014-01-22 Thread Devin Jeanpierre
On Wed, Jan 22, 2014 at 8:57 PM, Keith Winston wrote: > I'm working my way through some of the examples in > > http://ivory.idyll.org/articles/advanced-swc/#list-comprehensions > > And tried this one: > class MyTrickyIter: > ... def __init__(self, thelist): > ... self.thelist = thelist

[Tutor] iter class

2014-01-22 Thread Keith Winston
I'm working my way through some of the examples in http://ivory.idyll.org/articles/advanced-swc/#list-comprehensions And tried this one: >>> class MyTrickyIter: ... def __init__(self, thelist): ... self.thelist = thelist ... self.index = -1 ... ... def __iter__(self): ... retu

Re: [Tutor] when is "pythondontwritebytecode" useful?

2014-01-22 Thread eryksun
On Tue, Jan 21, 2014 at 2:44 PM, Albert-Jan Roskam wrote: > > Hmmm, number of OS * number of Python versions = a lot of packages. Isn't > a .zip file easiest? Or maybe msi or wininst*) on Windows and .deb on > Linux (with alien that can easily be converted to e.g. rpm). The egg format is old and

Re: [Tutor] Stuck on Challenge in Google Python Class

2014-01-22 Thread Keith Winston
On Wed, Jan 22, 2014 at 6:40 AM, Alan Gauld wrote: >> else: >>return ' ' > > > Notice that this return will throw you out of the function so > you don't process any more strings. You might like to look > at 'continue' as an alternative. You actually don't need to do anything with thi

Re: [Tutor] how to send "ctrl+a+c" with python

2014-01-22 Thread lei yang
thanks, it works for me Lei On Wed, Jan 22, 2014 at 10:35 PM, eryksun wrote: > On Wed, Jan 22, 2014 at 8:49 AM, lei yang wrote: > > > > I want to use pexpect to send "ctrl+a+c" > > What's ctrl+a+c? If this is for screen, then I think you mean ctrl+a c: > > sendcontrol('a') > send('c'

Re: [Tutor] how to send "ctrl+a+c" with python

2014-01-22 Thread eryksun
On Wed, Jan 22, 2014 at 8:49 AM, lei yang wrote: > > I want to use pexpect to send "ctrl+a+c" What's ctrl+a+c? If this is for screen, then I think you mean ctrl+a c: sendcontrol('a') send('c') ___ Tutor maillist - Tutor@python.org To unsubscr

[Tutor] how to send "ctrl+a+c" with python

2014-01-22 Thread lei yang
Hi expert, I want to use pexpect to send "ctrl+a+c" how should I do? self.vm_session.sendline("") how to fill ??? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinf

Re: [Tutor] Stuck on Challenge in Google Python Class

2014-01-22 Thread Alan Gauld
On 22/01/14 04:24, Adam Hurwitz wrote: A. match_ends # Given a list of strings, return the count of the number of # strings where the string length is 2 or more and the first # and last chars of the string are the same. Notice that you are asked to *return* a number not print it. Also notice t

Re: [Tutor] Stuck on Challenge in Google Python Class

2014-01-22 Thread Steven D'Aprano
On Tue, Jan 21, 2014 at 08:24:54PM -0800, Adam Hurwitz wrote: > Hi, > > This is a coding challenge in the Google Developers Python > Course. > I have been working on this challenge for hours without being able to solve. > > A. match_ends >

Re: [Tutor] Stuck on Challenge in Google Python Class

2014-01-22 Thread Dave Angel
Adam Hurwitz Wrote in message: > Many times when a function doesn't work, and you can't figure out why, it pays to factor the function, at least temporarily, and test the different parts. This might be your best bet in this case, especially when I tell you that you're very close. I the

Re: [Tutor] Stuck on Challenge in Google Python Class

2014-01-22 Thread spir
On 01/22/2014 05:24 AM, Adam Hurwitz wrote: Hi, This is a coding challenge in the Google Developers Python Course. I have been working on this challenge for hours without being able to solve. A. match_ends # Given a list of strings, retu