well you don't have to do it in a for loop, but hxs.select().extract() returns a list in any case, either empty list [], or list of values,
so instead of testing for empty list before accessing the first element in the extract() result (to prevent and IndexError exception),
like this:
urls = hxs.select('//a[@id="next"]/@href').extract()
if urls:
yield Request(urlparse.urljoin(response.url, urls[0]))
I usually use a for loop,
and sometimes add a break after that to get out at the first iteration, if I'm not sure how many matches I will get
I certainly wouldn't consider this as best practice though ;)
Cheers,
Paul.