On Wed, Dec 5, 2012 at 7:34 AM, Neil Cerutti <ne...@norwich.edu> wrote: > Well, shoot! Then this is a job for groupby, not takewhile.
The problem with groupby is that you can't just limit it to two groups. >>> prod_desc("CAPSICUM RED fresh from QLD") ['QLD', 'fresh from'] Once you've got a false key from the groupby, you would need to pretend that any subsequent groups are part of the false group and tack them on. -- http://mail.python.org/mailman/listinfo/python-list