Re: [Tutor] Python debugger/IDE that can be launched from a remote command line

2013-05-10 Thread Abhishek Pratap
On Fri, May 10, 2013 at 10:58 AM, Michael O'Leary wrote: > I am working on a project in which the code and data I am working with are > all on an Amazon EC2 machine. So far I have been ssh'ing to the EC2 machine > in two terminal windows, running emacs or vi in one of them to view and > update the

Re: [Tutor] help with itertools.izip_longest

2013-03-16 Thread Abhishek Pratap
On Sat, Mar 16, 2013 at 2:53 PM, Peter Otten <__pete...@web.de> wrote: > Abhishek Pratap wrote: > >> I am trying to use itertools.izip_longest to read a large file in >> chunks based on the examples I was able to find on the web. However I >> am not able to u

Re: [Tutor] help with itertools.izip_longest

2013-03-16 Thread Abhishek Pratap
On Sat, Mar 16, 2013 at 2:32 PM, Oscar Benjamin wrote: > On 16 March 2013 21:14, Abhishek Pratap wrote: >> Hey Guys >> >> I am trying to use itertools.izip_longest to read a large file in >> chunks based on the examples I was able to find on the web. However I >&

[Tutor] help with itertools.izip_longest

2013-03-16 Thread Abhishek Pratap
Hey Guys I am trying to use itertools.izip_longest to read a large file in chunks based on the examples I was able to find on the web. However I am not able to understand the behaviour of the following python code. (contrived form of example) for x in itertools.izip_longest(*[iter([1,2,3])]*2)

Re: [Tutor] increment a counter inside generator

2013-03-13 Thread Abhishek Pratap
On Wed, Mar 13, 2013 at 2:08 PM, Dave Angel wrote: > On 03/13/2013 03:50 PM, Abhishek Pratap wrote: >> >> Hey Guys >> >> I might be missing something obvious here. >> >> >> import numpy as np >> >> count = 0 >> [ count += 1 for num i

Re: [Tutor] increment a counter inside generator

2013-03-13 Thread Abhishek Pratap
On Wed, Mar 13, 2013 at 2:02 PM, Oscar Benjamin wrote: > On 13 March 2013 19:50, Abhishek Pratap wrote: >> Hey Guys >> >> I might be missing something obvious here. >> >> >> import numpy as np >> >> count = 0 >> [ count += 1 for num in np.

[Tutor] increment a counter inside generator

2013-03-13 Thread Abhishek Pratap
Hey Guys I might be missing something obvious here. import numpy as np count = 0 [ count += 1 for num in np.random.random_integers(1,100,20) if num > 20] File "", line 2 [ count += 1 for num in np.random.random_integers(1,100,20) if num > 20] ^ SyntaxError: invalid syntax A

[Tutor] learning to program in cython

2013-01-16 Thread Abhishek Pratap
Hi Guys With the help of an awesome python community I have been able to pick up the language and now willing to explore other cool extensions of it. I routinely have large loops which could be ported to cython for speed. However I have never written a single line of cython code. Any pointers on

Re: [Tutor] managing memory large dictionaries in python

2012-10-16 Thread Abhishek Pratap
On Tue, Oct 16, 2012 at 7:22 PM, Alexander wrote: > On Tue, Oct 16, 2012 at 20:43 EST, Mark Lawrence > wrote: >> For the record Access is not a database, or so some geezer called Alex >> Martelli reckons http://code.activestate.com/lists/python-list/48130/, so >> please don't shoot the messenger:

[Tutor] managing memory large dictionaries in python

2012-10-16 Thread Abhishek Pratap
Hi Guys For my problem I need to store 400-800 million 20 characters keys in a dictionary and do counting. This data structure takes about 60-100 Gb of RAM. I am wondering if there are slick ways to map the dictionary to a file on disk and not store it in memory but still access it as dictionary o

[Tutor] using multiprocessing efficiently to process large data file

2012-08-30 Thread Abhishek Pratap
Hi Guys I have a with few million lines. I want to process each block of 8 lines and from my estimate my job is not IO bound. In other words it takes a lot more time to do the computation than it would take for simply reading the file. I am wondering how can I go about reading data from this at a

[Tutor] *large* python dictionary with persistence storage for quick look-ups

2012-08-06 Thread Abhishek Pratap
Hey Guys I have asked a question on stackoverflow and thought I would post it here as it has some learning flavor attached to it...atleast I feel that. http://stackoverflow.com/questions/11837229/large-python-dictionary-with-persistence-storage-for-quick-look-ups -Abhi __

Re: [Tutor] Problem When Iterating Over Large Test Files

2012-07-18 Thread Abhishek Pratap
Hi Ryan One quick comment I dint get through all your code to figure out the fine details but my hunch is you might be having issues related to linux to dos EOF char. Could you check the total number of lines in your fastq# are same as read by a simple python file iterator. If not then it is

Re: [Tutor] updating step size while in loop

2012-07-09 Thread Abhishek Pratap
Ok thanks Hugo. I have the while loop working -A On Mon, Jul 9, 2012 at 3:06 PM, Hugo Arts wrote: > On Mon, Jul 9, 2012 at 11:59 PM, Abhishek Pratap > wrote: >> >> hey guys >> >> I want to know whether it is possible for dynamically update the step >> si

[Tutor] updating step size while in loop

2012-07-09 Thread Abhishek Pratap
hey guys I want to know whether it is possible for dynamically update the step size in xrange or someother slick way. Here is what I am trying to do, if during a loop I find the x in list I want to skip next #n iterations. for x in xrange(start,stop,step): if x in list: step = 14

Re: [Tutor] generators

2012-04-03 Thread Abhishek Pratap
Hey Mike The following link should help you. http://www.dabeaz.com/generators/ . Cool slide deck with examples from David Beazley's explanation of generators. -A On Tue, Apr 3, 2012 at 11:38 AM, mike jackson wrote: > I am trying understand python and have done fairly well, So for it has be

Re: [Tutor] concurrent file reading using python

2012-03-26 Thread Abhishek Pratap
Thanks Walter and Steven for the insight. I guess I will post my question to python main mailing list and see if people have anything to say. -Abhi On Mon, Mar 26, 2012 at 3:28 PM, Walter Prins wrote: > Abhi, > > On 26 March 2012 19:05, Abhishek Pratap wrote: >> I want to utili

[Tutor] concurrent file reading using python

2012-03-26 Thread Abhishek Pratap
Hi Guys I want to utilize the power of cores on my server and read big files (> 50Gb) simultaneously by seeking to N locations. Process each separate chunk and merge the output. Very similar to MapReduce concept. What I want to know is the best way to read a file concurrently. I have read about

Re: [Tutor] weird error in my python program : merge sort : resolved

2012-03-22 Thread Abhishek Pratap
I was not updating the list from the recursive call. >     merge_sort(left,'left') >     merge_sort(right,'right') left = merge_sort(left,'left') right = merge_sort(right,'right') -A -Abhi On Thu, Mar 22, 2012 at 1:40 PM, Abhishek Pratap wr

[Tutor] weird error in my python program : merge sort

2012-03-22 Thread Abhishek Pratap
I am imlpementing a merge sort algo for clarity purposes but my program is giving me weird answers. Sometimes it is able to sort and other times it does funky things. Help appreciated from random import * from numpy import * nums = [random.randint(100) for num in range(4)] #nums = [3,7,2,10] de

Re: [Tutor] feedback on writing pipelines in python

2012-03-21 Thread Abhishek Pratap
it is subjective. Having many options can be good for some. -Abhi On Wed, Mar 21, 2012 at 11:20 AM, Steve Willoughby wrote: > On 21-Mar-12 11:03, Abhishek Pratap wrote: > >> Hi Guys >> >> I am in the process of perl to python transition for good. I wanted to >

[Tutor] feedback on writing pipelines in python

2012-03-21 Thread Abhishek Pratap
Hi Guys I am in the process of perl to python transition for good. I wanted to get some feedback or may be best practice for the following. 1. stitch pipelines : I want python to act as a glue allowing me to run various linux shell based programs. If needed wait for a program to finish and then

Re: [Tutor] inserting new lines in long strings while printing

2012-03-06 Thread Abhishek Pratap
thanks guys .. -Abhi On Tue, Mar 6, 2012 at 5:41 PM, Steven D'Aprano wrote: > On Tue, Mar 06, 2012 at 05:26:26PM -0800, Abhishek Pratap wrote: > > I have this one big string in python which I want to print to a file > > inserting a new line after each 100 characters. Is

[Tutor] inserting new lines in long strings while printing

2012-03-06 Thread Abhishek Pratap
I have this one big string in python which I want to print to a file inserting a new line after each 100 characters. Is there a slick way to do this without looping over the string. I am pretty sure there shud be something its just I am new to the lang. Thanks! -Abhi

[Tutor] creating dict of dict : similar to perl hash of hash

2012-03-06 Thread Abhishek Pratap
Hi Guys I am looking for a way to build dictionaries of dict in python. For example in perl I could do my $hash_ref = {}; $hash->{$a}->{$b}->{$c} = "value"; if (exists $hash->{$a}->{$b}->{$c} ){ print "found value"} Can I do something similar with dictionaries in Python. Thanks -Abhi

Re: [Tutor] ignoring certain lines while reading through CSV

2012-01-27 Thread Abhishek Pratap
Thansk Joel. Thats exactly what I am doing. -A On Fri, Jan 27, 2012 at 3:04 PM, Joel Goldstick wrote: > On Fri, Jan 27, 2012 at 5:48 PM, Abhishek Pratap > wrote: >> Hi Joel >> >> Here is a sample >> >> ['1', 'AAA', '4344'

Re: [Tutor] ignoring certain lines while reading through CSV

2012-01-27 Thread Abhishek Pratap
in csv.reader to ignore lines. -Abhi On Fri, Jan 27, 2012 at 2:42 PM, Joel Goldstick wrote: > On Fri, Jan 27, 2012 at 5:13 PM, Abhishek Pratap > wrote: >> Hi Guys >> >> I am wondering if there is a keyword to ignore certain lines ( for eg >> lines star

[Tutor] ignoring certain lines while reading through CSV

2012-01-27 Thread Abhishek Pratap
Hi Guys I am wondering if there is a keyword to ignore certain lines ( for eg lines starting with # ) when I am reading them through stl module csv. Example code: input_file = sys.argv[1] csv.register_dialect('multiplex_info',delimiter=' ') with open(input_file, 'rb') as fh: reader= csv.rea

Re: [Tutor] how to calculate execution time and complexity

2011-10-27 Thread Abhishek Pratap
Hi Praveen I am still new to the language but here is what I would do. Sorry I can't comment on how to best check for efficiency. my_str='google' split_by= 2 [ my_str[i:i+split_by] for i in range(0, len(my_str), split_by) ] Just using a list comprehension. best, -Abhi On Thu, Oct 27, 2011 a