Re: Memory error due to big input file

2009-07-13 Thread Vilya Harvey
2009/7/13 Aaron Scott : >> BTW, you should derive all your classes from something.  If nothing >> else, use object. >>   class textfile(object): > > Just out of curiousity... why is that? I've been coding in Python for > a long time, and I never derive my base classes. What's the advantage > to der

Re: Best Way to Handle All Exceptions

2009-07-13 Thread Vilya Harvey
2009/7/13 seldan24 : > Thank you both for your input.  I want to make sure I get started on > the right track.  For this particular script, I should have included > that I would take the exception contents, and pass those to the > logging module.  For this particular script, all exceptions are fata

Re: Question about generators

2009-07-12 Thread Vilya Harvey
2009/7/12 Cameron Pulsford : > My question is, is it possible to combine those two loops? The primes > generator I wrote finds all primes up to n, except for 2, 3 and 5, so I must > check those explicitly. Is there anyway to concatenate the hard coded list > of [2,3,5] and the generator I wrote so

Re: count

2009-07-08 Thread Vilya Harvey
2009/7/8 Dhananjay : > I wanted to sort column 2 in assending order  and I read whole file in array > "data" and did the following: > > data.sort(key = lambda fields:(fields[2])) > > I have sorted column 2, however I want to count the numbers in the column 2. > i.e. I want to know, for example, how

Re: Why is my code faster with append() in a loop than with a large list?

2009-07-06 Thread Vilya Harvey
2009/7/6 Xavier Ho : > Why is version B of the code faster than version A? (Only three lines > different) Here's a guess: As the number you're testing gets larger, version A is creating very big list. I'm not sure exactly how much overhead each list entry has in python, but I guess it's at least

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Vilya Harvey
2009/7/4 Steven D'Aprano : > On Sat, 04 Jul 2009 13:42:06 +, Steven D'Aprano wrote: > >> On Sat, 04 Jul 2009 10:55:44 +0100, Vilya Harvey wrote: >> >>> 2009/7/4 Andre Engels : >>>> On Sat, Jul 4, 2009 at 9:33 AM, mclovin wrote: >>&

Re: Reversible Debugging

2009-07-04 Thread Vilya Harvey
2009/7/4 Patrick Sabin : > If someone has another idea of taking a snapshot let me know. Using VMWare > is not a > very elegant way in my opinion. Someone implemented the same idea for Java a while ago. They called it "omniscient debugging"; you can find details at http://www.lambdacs.com/debu

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Vilya Harvey
2009/7/4 Andre Engels : > On Sat, Jul 4, 2009 at 9:33 AM, mclovin wrote: >> Currently I need to find the most common elements in thousands of >> arrays within one large array (arround 2 million instances with ~70k >> unique elements) >> >> so I set up a dictionary to handle the counting so when I a