On Jun 9, 2014, at 11:57 AM, Paul Sokolovsky wrote: > This is very Pythonic, Python is strictly typed language. There's no > way None could possibly be "inside" a string, so if you're trying to > look for it there, you're doing something wrong, and told so.
Well, the code we've got is: hourly_data = [(t if status in 'CSRP' else None) for (t, status) in hours] where status can be None. I don't think I'm doing anything wrong. I wrote exactly what I mean :-) We've changed it to: hourly_data = [(t if (status and status in 'CSRP') else None) for (t, status) in hours] but that's pretty ugly. In retrospect, I suspect: hourly_data = [(t if status in set('CSRP') else None) for (t, status) in hours] is a little cleaner. --- Roy Smith r...@panix.com
-- https://mail.python.org/mailman/listinfo/python-list