Issue #41 resolved

filter method parameters

xyzchw
created an issue

now the filter method accept a selector function taking an index parameter, like {{{

!python

pq.filter(lambda i: PyQuery(this).attr('href')=='http://python.org')

}}}

I looked into the code and know the internal gum of what this mean. But it is not friendly to code checkers like Pylint, which will report that the 'this' here is undefined.

why not just accept an selector which takes (index, element) as its parmeter as following? {{{

!python

pq.filter(lambda i, this: PyQuery(this).attr('href')=='http://python.org')

}}}

It's more apparent, easy to read, and more friendly to code checker.

Comments (1)

  1. Log in to comment