Re: [Tutor] making lists of prime numbers

2011-09-14 Thread Andre Engels
On Thu, Sep 15, 2011 at 4:01 AM, c smith wrote: > hi list, i am trying the MIT opencourseware assignments. > one was to find the 1000th prime. > since this isn't actually my homework, I modified the solution as I would > like to collect lists of primes and non-primes up to N, also some log() > rat

[Tutor] making lists of prime numbers

2011-09-14 Thread c smith
hi list, i am trying the MIT opencourseware assignments. one was to find the 1000th prime. since this isn't actually my homework, I modified the solution as I would like to collect lists of primes and non-primes up to N, also some log() ratio to one comparison. here is what I came up with on paper:

Re: [Tutor] telnetlib's read_very_eager() method?

2011-09-14 Thread James Hartley
On Wed, Sep 14, 2011 at 1:13 PM, Walter Prins wrote: > On 14 September 2011 21:03, James Hartley wrote: > >> On Wed, Sep 14, 2011 at 12:54 PM, Walter Prins wrote: >> > Aside: If you want to interact with a mail server there's probably better >> modules to be using than the telnet module. >> >>>

Re: [Tutor] telnetlib's read_very_eager() method?

2011-09-14 Thread Walter Prins
On 14 September 2011 21:03, James Hartley wrote: > On Wed, Sep 14, 2011 at 12:54 PM, Walter Prins wrote: > >> Hence, try using read_some() instead of read_very_eager(). >> > > read_some() captures what I was hoping to catch. Thanks! > > >> >> Aside: If you want to interact with a mail server th

Re: [Tutor] telnetlib's read_very_eager() method?

2011-09-14 Thread James Hartley
On Wed, Sep 14, 2011 at 12:54 PM, Walter Prins wrote: > Hence, try using read_some() instead of read_very_eager(). > read_some() captures what I was hoping to catch. Thanks! > > Aside: If you want to interact with a mail server there's probably better > modules to be using than the telnet mod

Re: [Tutor] telnetlib's read_very_eager() method?

2011-09-14 Thread Walter Prins
On 14 September 2011 20:44, James Hartley wrote: > #!/usr/bin/env python > > import telnetlib > > if __name__ == '__main__': > print 'begin' > tn = telnetlib.Telnet('gmail-smtp-in.l.google.com', 25) > s = tn.read_very_eager() > print s > tn.write("helo\n") > s = tn.read_ve

[Tutor] telnetlib's read_very_eager() method?

2011-09-14 Thread James Hartley
I'm trying to programmatically create a telnet session. Within the interactive environment, this appears to work very well as server messages can be saved as strings: $ python Python 2.7.1 (r271:86832, Sep 3 2011, 01:32:33) [GCC 4.2.1 20070719 ] on openbsd5 Type "help", "copyright", "credits" or