Re: [BangPypers] nested list question

2010-07-22 Thread Anand Balachandran Pillai
On Thu, Jul 15, 2010 at 9:50 AM, Srinivas Reddy Thatiparthy < srinivas_thatipar...@akebonosoft.com> wrote: > I read from Python 2.6.3 docs that,copied from chm > > " Note that filter(function, iterable) is equivalent to [item for item in > iterable if function(item)] if function is not None an

Re: [BangPypers] nested list question

2010-07-14 Thread Srinivas Reddy Thatiparthy
I read from Python 2.6.3 docs that,copied from chm " Note that filter(function, iterable) is equivalent to [item for item in iterable if function(item)] if function is not None and [item for item in iterable if item] if function is None." Since they said *equivalent* ,i thought both transfo

Re: [BangPypers] nested list question

2010-07-14 Thread Jeffrey Jose
> List comprehensions are preferred to map and filter functions.In fact, > filter is a syntactic sugar to list comprehension. > > You're right in saying list comprehensions are preferred to map and filter - not just from a readability standpoint but also from a performance standpoint. (we all hate

Re: [BangPypers] nested list question

2010-07-14 Thread Vikram
> Suppose you have two nested lists, X and Y. > A sample element of X is: > ['NM_032291', '6741', '6751', 'chr1', '+'] > > Another sample element of X is: > ['NM_001097', '51183080', '51183635', 'chr22', '+'] > > > A sample element of Y is: > ['chr1', '6746'] > > Another

Re: [BangPypers] nested list question

2010-07-13 Thread Srinivas Reddy Thatiparthy
>map (function, list1, list2) where in function you can create your desired >list. List comprehensions are preferred to map and filter functions.In fact, filter is a syntactic sugar to list comprehension. Regards, Srini T. --When you are playing cricket, you should hit the ball out of the gro

Re: [BangPypers] nested list question

2010-07-13 Thread Shashwat Anand
On Wed, Jul 14, 2010 at 9:01 AM, Shashwat Anand wrote: > > > On Tue, Jul 13, 2010 at 8:00 PM, Vikram wrote: > >> Suppose you have two nested lists, X and Y. >> A sample element of X is: >> ['NM_032291', '6741', '6751', 'chr1', '+'] >> >> Another sample element of X is: >> ['NM_001097', '5

Re: [BangPypers] nested list question

2010-07-13 Thread Shashwat Anand
On Tue, Jul 13, 2010 at 8:00 PM, Vikram wrote: > Suppose you have two nested lists, X and Y. > A sample element of X is: > ['NM_032291', '6741', '6751', 'chr1', '+'] > > Another sample element of X is: > ['NM_001097', '51183080', '51183635', 'chr22', '+'] > > > A sample element of Y is: >

Re: [BangPypers] nested list question

2010-07-13 Thread Nitin Kumar
I think you can very well use map function map (function, list1, list2) where in function you can create your desired list. What map will do is it will call function for each element from list1 and list2 (same indexed) and will do the stuff defined in the function. Do let me know if i am close to

Re: [BangPypers] nested list question

2010-07-13 Thread Pradip P Caulagi
On Tue, Jul 13, 2010 at 02:30:41PM -, Vikram wrote: > Suppose you have two nested lists, X and Y. > A sample element of X is: > ['NM_032291', '6741', '6751', 'chr1', '+'] > > Another sample element of X is: > ['NM_001097', '51183080', '51183635', 'chr22', '+'] > > > A sample eleme

[BangPypers] nested list question

2010-07-13 Thread Vikram
Suppose you have two nested lists, X and Y. A sample element of X is: ['NM_032291', '6741', '6751', 'chr1', '+'] Another sample element of X is: ['NM_001097', '51183080', '51183635', 'chr22', '+'] A sample element of Y is: ['chr1', '6746'] Another sample element of Y is: ['chrY',