Re: Tkinter/scrollbar/canvas question

2011-06-21 Thread Saul Spatz
This is the third time I've tried to post this reply. If you see multiple answers from me, that's why. Your script will work if you change it like so: from tkinter import * class ShowList(Frame): def __init__(self, root): Frame.__init__(self, root) self.g

Re: How can I speed up a script that iterates over a large range (600 billion)?

2011-06-21 Thread Terry Reedy
On 6/21/2011 8:00 PM, Paul Rubin wrote: Terry Reedy writes: efficient implementation will allow a solution to be obtained on a modestly powered computer in less than one minute." If something really takes a minute in C, allow yourself at least 10 minutes or even more with plain CPython. No.

Re: Emails backup in python 3.2

2011-06-21 Thread Michael Hrivnak
Why not use one of the many projects and products that are designed to store email? Do you have a special reason for wanting to implement your own email storage? I'm thinking that you can use fetchmail with your favorite mail store, and you won't need to write any code at all. http://fetchmail.b

Re: Handling import errors

2011-06-21 Thread Chris Rebert
On Tue, Jun 21, 2011 at 1:51 PM, Guillaume Martel-Genest wrote: > What is the pythonic way to handle imports error? What is bugging me > is that the imports can't be inside a function (because I use them in > different places in the script and thus they have to be in the global > scope). I would w

Re: Tkinter/scrollbar/canvas question

2011-06-21 Thread Saul Spatz
It works if you change it like so: from tkinter import * class ShowList(Frame): def __init__(self, root): Frame.__init__(self, root) self.grid() self.draw_widgets() def draw_widgets(self): cframe = Frame(self)

Re: Tkinter/scrollbar/canvas question

2011-06-21 Thread Chris Angelico
On Wed, Jun 22, 2011 at 1:50 PM, Saul Spatz wrote: > This is the third time I've tried to post this reply.  If you see multiple > answers from me, that's why. > All three came through on the mailing list, but out of order - this one came in second. Chris Angelico -- http://mail.python.org/mail

Re: How can I speed up a script that iterates over a large range (600 billion)?

2011-06-21 Thread Paul Rubin
Terry Reedy writes: > If the best C program for a problem takes 10 seconds or more, then > applying the same 1 minute limit to Python is insane, and contrary to > the promotion of good algorithm thinking. The Euler problems are all designed to be doable in 1 minute or less and the Euler project s

Re: Security test of embedded Python

2011-06-21 Thread Dennis
Hi, The Google App Engine product seems to sandbox Python code, however it comes with a lot of limitations and maybe those can be an inspiration for how you design your infrastructure. http://code.google.com/appengine/docs/python/overview.html http://code.google.com/appengine/kb/commontasks.html

Re: How can I speed up a script that iterates over a large range (600 billion)?

2011-06-21 Thread Chris Torek
Now that the exercise has been solved... Instead of "really short code to solve the problem", how about some "really long code"? :-) I was curious about implementing prime factorization as a generator, using a prime-number generator to come up with the factors, and doing memoization of the gener

Re: How can I speed up a script that iterates over a large range (600 billion)?

2011-06-21 Thread Paul Rubin
Chris Torek writes: > def primes(): > """ > Yields sequence of prime numbers via Sieve of Eratosthenes. > """ I think this has the same order-complexity but is enormously slower in practice, and runs out of recursion stack after a while. Exercise: spot the recursion. from iterto

<    1   2