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, presumably for disk filenames, although this sounds like just
> a string processing function that would work with non-pathnames too.

I think it is the commonprefix() call that is expensive, not the filter.
> 
> 
>>> and I don't understand what that 'bool' is doing.  Or rather, I think
>>> that I see what it is doing, but I am not sure - and I don't much like it.
>>    :
>>> I tried replacing 'bool'...
> 
> it sounds like you did not develop the original code.  it seems to
> work... why are you trying to replace it?  are you refactoring?

He is porting to Jython which doesn't have bool(), which was introduced 
in CPython 2.2.

Kent

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to