Re: [Tutor] Tutor Digest, Vol 53, Issue 99

2008-07-28 Thread kinuthiA muchanE
On Tue, 2008-07-29 at 01:12 +0200, [EMAIL PROTECTED] wrote: > Message: 3 > Date: Mon, 28 Jul 2008 13:26:13 -0500 > From: "Daniel Sarmiento" <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Memory error - how to manage large data sets? > To: tutor@python.org > Message-ID: > <[EMAIL PROTECTED]> >

Re: [Tutor] Memory error - how to manage large data sets?

2008-07-28 Thread Daniel Sarmiento
>(the solution, of course, is to avoid storing all those numbers in the >first place) I tried this: fib = {0:0,1:1} sum = 0 for j in xrange (2,100): i = fib[j-1] + fib[j-2] if i % 2 == 0: sum += i fib = {j-1:fib[j-1], j:i} print sum I guess it should come up with the ri

Re: [Tutor] Turtle problem: how to exit the .exe?

2008-07-28 Thread Dick Moores
At 05:30 PM 7/28/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote Tkinter is involved, turtle usesw Tkinter. Yes, I allowed for that when I made the .exe: python Makespec.py -FKc E:\PyInstaller\MyScripts\randomTriangles_wo_named_colorsV13.exe Means nothing to me, I've never

Re: [Tutor] Turtle problem: how to exit the .exe?

2008-07-28 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote Tkinter is involved, turtle usesw Tkinter. Yes, I allowed for that when I made the .exe: python Makespec.py -FKc E:\PyInstaller\MyScripts\randomTriangles_wo_named_colorsV13.exe Means nothing to me, I've never found a need to make an exe from a python

Re: [Tutor] Memory error - how to manage large data sets?

2008-07-28 Thread Alan Gauld
"Alan Gauld" <[EMAIL PROTECTED]> wrote > were infinite using floats! So you need to calculate the > total as you go without saving the values > I got curious so wrote the following function: >>> def fibtot(N): ... f0,f1,tot = 0,1,1 ... for n in range(N): ... f = f0 + f1 ... f0,f1 =

Re: [Tutor] Memory error - how to manage large data sets?

2008-07-28 Thread Chris Fuller
There's no need to keep any lists. The sum can be done on the fly, which is perhaps a bit slower, but takes a constant amount of ram. Even storing every other element (or every third, which is what he's trying to do: the elements that are even numbers, not every other element.. See his exampl

Re: [Tutor] Memory error - how to manage large data sets?

2008-07-28 Thread John Fouhy
On 29/07/2008, Daniel Sarmiento <[EMAIL PROTECTED]> wrote: > I tried to run your code and checked (with top) the memory ussage and > it uses more than 2 Gb of memory. > > I tried to modify the code a little bit to use less memory and came up > with this: > > fib = {0:0,1:1} > > even = [] > >

Re: [Tutor] Turtle problem: how to exit the .exe?

2008-07-28 Thread Dick Moores
At 03:32 PM 7/28/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote But I'd like to make a version of the script that doesn't report any data. How can I write it so that the .exe can be easily exited by the user? If Tkinter instead of Turtle were involved, I could have an Exit b

Re: [Tutor] Memory error - how to manage large data sets?

2008-07-28 Thread Alan Gauld
"Karthik" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Forgot to include the following information, Platform - win32 Version - 2.5.1 Error message: Traceback (most recent call last): File "C:\Python25\programs\fibo.py", line 10, in if i % 2 == 0: MemoryError OK, It does look

Re: [Tutor] Turtle problem: how to exit the .exe?

2008-07-28 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote But I'd like to make a version of the script that doesn't report any data. How can I write it so that the .exe can be easily exited by the user? If Tkinter instead of Turtle were involved, I could have an Exit button connected to command=root.quit . T

Re: [Tutor] Unable to Reconfigure IDLE

2008-07-28 Thread Thomas Corbett
On Jul 27, 2008, at 7:16 AM, Tim Golden wrote: Thomas Corbett wrote: On Jul 26, 2008, at 9:02 AM, Alan Gauld wrote: "Thomas Corbett" <[EMAIL PROTECTED]> wrote Configured shell window to wrong size, now can't seem to find the menu (Options > Configure) to resize the shell. Don't you jus

[Tutor] login using PAM

2008-07-28 Thread johnf
I have been attempting to research the web on how python-pam works. Does anyone have example code? -- John Fabiani ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Turtle problem: how to exit the .exe?

2008-07-28 Thread Dick Moores
Win XP, Python 2.51 The script is at It calls the Windows console to show the printed data. I've successfully used PyInstaller to make an .exe for this. For informed users, exiting the program before it finishes is easily and cleanly done by a Ct

Re: [Tutor] Memory error - how to manage large data sets?

2008-07-28 Thread Daniel Sarmiento
Hi I tried to run your code and checked (with top) the memory ussage and it uses more than 2 Gb of memory. I tried to modify the code a little bit to use less memory and came up with this: fib = {0:0,1:1} even = [] def fibonacci(x,y): return x+y for j in xrange (2,100): i = fib[j-1]

Re: [Tutor] Memory error - how to manage large data sets?

2008-07-28 Thread Danny Yoo
> 1. I need to find the sum of all numbers at even positions in the > Fibonacci series upto 2 million. > > 2. I have used lists to achieve this. I see. You may want to produce a "sequence" or "iterator" of fibonacci numbers rather than an explicit list. As it is, your machine does not ha

Re: [Tutor] Memory error - how to manage large data sets?

2008-07-28 Thread Chris Fuller
On Monday 28 July 2008 10:56, Karthik wrote: > Hi, > > > > I am new to Python programming, I was trying to work out a few problems in > order to grasp the knowledge gained after going through the basic chapters > on Python programming. I got stuck with a memory error. > > > > Following is what I di

Re: [Tutor] Memory error - how to manage large data sets?

2008-07-28 Thread Karthik
Forgot to include the following information, Platform - win32 Version - 2.5.1 Error message: Traceback (most recent call last): File "C:\Python25\programs\fibo.py", line 10, in if i % 2 == 0: MemoryError Code: fib = [] even = [] def fibonacci(x,y): return x+y

Re: [Tutor] Memory error - how to manage large data sets?

2008-07-28 Thread Alan Gauld
"Karthik" <[EMAIL PROTECTED]> wrote I am new to Python programming, I was trying to work out a few problems in order to grasp the knowledge gained after going through the basic chapters on Python programming. I got stuck with a memory error. Always show us the full error text, it contains

[Tutor] Memory error - how to manage large data sets?

2008-07-28 Thread Karthik
Hi, I am new to Python programming, I was trying to work out a few problems in order to grasp the knowledge gained after going through the basic chapters on Python programming. I got stuck with a memory error. Following is what I did, 1. I need to find the sum of all numbers at even

Re: [Tutor] Online class/education for Python?

2008-07-28 Thread bhaaluu
On Sun, Jul 27, 2008 at 12:13 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > At 07:18 AM 7/27/2008, bhaaluu wrote: > >> So if >> a student goes through PPftAB2E, and wants to continue programming games, >> I'd recommend "Game Programming" by Andy Harris [ISBN-13: >> 978-0-470-06822-9]. >> Game Progra

Re: [Tutor] Creating a unicode string from bytes and % opperator

2008-07-28 Thread Tim Golden
Wesley Brooks wrote: Thanks Tim Golden, That'll do the trick! Thought there must have been something simple for it! To be perverse, you *could* have done it like this: eval ("u'\u" + "%s%s'" % ("0d", "fe")) But please don't :) TJG ___ Tutor mailli

Re: [Tutor] Creating a unicode string from bytes and % opperator

2008-07-28 Thread Wesley Brooks
Thanks Tim Golden, That'll do the trick! Thought there must have been something simple for it! Cheers, Wesley Brooks 2008/7/28 Tim Golden <[EMAIL PROTECTED]>: > Wesley Brooks wrote: >> >> I'm trying to create a unicode character from two bytes. Unfortunatly >> I'm getting a "UnicodeDecodeError"

Re: [Tutor] Creating a unicode string from bytes and % opperator

2008-07-28 Thread Tim Golden
Wesley Brooks wrote: I'm trying to create a unicode character from two bytes. Unfortunatly I'm getting a "UnicodeDecodeError". Can some one please suggest an alternative way of doing what's bellow? In the example bellow the two bytes have been converted into a string hex value, but they could jus

[Tutor] Creating a unicode string from bytes and % opperator

2008-07-28 Thread Wesley Brooks
Dear Users, I'm trying to create a unicode character from two bytes. Unfortunatly I'm getting a "UnicodeDecodeError". Can some one please suggest an alternative way of doing what's bellow? In the example bellow the two bytes have been converted into a string hex value, but they could just as easil