title: How to reverse list order in Python and stop yield upon return of None?
body: <p>I am generating pagination links which I suspect exists with Python 3.x:</p>
  <pre><code>start_urls = [
      'https://...',
      'https://...' # list full of URLs
  ]
  
  def start_requests(self):
      for url in self.start_urls:
          yield scrapy.Request(
              url = url,
              meta={'handle_httpstatus_list': [301]},
              callback=self.parse,
          )
  
  def parse(self, response):
      for i in range(1, 6):
          url = response.url + '&amp;pn='+str(i)
          yield scrapy.Request(url, self.parse_item)
  
  def parse_item(self, response):
  
          # check if no results page
          if response.xpath('//*[@id=&quot;searchList&quot;]/div[1]').extract_first():
              self.logger.info('No results found on  %s', response.url)
              return None
          ...
  </code></pre>
  <p>Those URLs will be processed by scrapy in parse_item. Now there are 2 problems:</p>
  <ol>
  <li><p>The order is reverse and I do not understand why. It will request pagen umbers: 5,4,3,2,1 instead of 1,2,3,4,5</p>
  </li>
  <li><p>If the no results are found on page 1, the entire series could be stoped. Parse Item returns already &quot;None&quot;, but the I guess I need to adapt the method &quot;parse&quot; to exit the for loop and continue. How?</p>
  </li>
  </ol>