1. Olivier Lauzanne
  2. pyquery
  3. Issues
Issue #27 wontfix

Unexpected iteration behavier

Anonymous created an issue

Iteration over //PyQuery //object should yield //PyQuery //intuitively

====== Other reasons ====== for chained operations for not to learn //lxml //objects

====== Example ======



for a in PyQuery(url='http://www.google.com')('a'): print a

<Element a at 0x2ad3630> // a.attr.XXX? gotcha <Element a at 0x2ad3660> <Element a at 0x2ad3690> <Element a at 0x2ad36c0> <Element a at 0x2ad36f0> <Element a at 0x2ad3720> <Element a at 0x2ad3750> <Element a at 0x2ad3780>


====== Workaround ======

This should be the default way of iteration

The underlay //lxml// node should be retrieved by d.element



def iterpq(d): for i in range(len(d)): yield d.eq(i)


Comments (2)

  1. Log in to comment