On Tue, Jun 10, 2014 at 2:53 AM, Roy Smith <r...@panix.com> wrote:
> In retrospect, I suspect:
>           hourly_data = [(t if status in set('CSRP') else None) for (t,
> status) in hours]
> is a little cleaner.

I'd go with this. It's clearer that a status of 'SR' should result in
False, not True. (Presumably that can never happen, but it's easier to
read.) I'd be inclined to use set literal syntax, even though it's a
bit longer - again to make it clear that these are four separate
strings that you're checking against.

Alternatively, you could go "if status or '0' in 'CSRP", which would
work, but be quite cryptic. (It would also mean that '' is not deemed
to be in the string, same as the set() transformation does.)


Reply via email to