Re: [Tutor] A Python idiom that I don't get

2006-04-26 Thread Don Taylor
w chun wrote: > it sounds like you did not develop the original code. it seems to > work... why are you trying to replace it? are you refactoring? No it is not my code. I am trying to get it running in Jython which does not support the bool function. I may refactor it after I get it working i

Re: [Tutor] A Python idiom that I don't get

2006-04-26 Thread Kent Johnson
w chun wrote: >>> prefix = os.path.commonprefix(filter( bool, lines )) > > that is an interesting and yes, not very optimal way of saving the set > of non-blank lines. the commonprefix() function takes a list of > pathnames and returns the longest prefix that all strings have in > common, pr

Re: [Tutor] A Python idiom that I don't get

2006-04-25 Thread w chun
> > prefix = os.path.commonprefix(filter( bool, lines )) that is an interesting and yes, not very optimal way of saving the set of non-blank lines. the commonprefix() function takes a list of pathnames and returns the longest prefix that all strings have in common, presumably for disk filena

Re: [Tutor] A Python idiom that I don't get

2006-04-25 Thread Kent Johnson
Don Taylor wrote: > I am trying to get some existing CPython 2.4 code working under Jython > (2.1) and I am puzzled by a line in the following function. It seems to > be a Python 2.4 idiom that is opaque to me. > > The line is: > prefix = os.path.commonprefix(filter( bool, lines )) > > an

[Tutor] A Python idiom that I don't get

2006-04-25 Thread Don Taylor
I am trying to get some existing CPython 2.4 code working under Jython (2.1) and I am puzzled by a line in the following function. It seems to be a Python 2.4 idiom that is opaque to me. The line is: prefix = os.path.commonprefix(filter( bool, lines )) and I don't understand what that 'bo