cbr...@cbrownsystems.com <cbr...@cbrownsystems.com> wrote: > It's clear but tedious to write: > > if 'monday" in days_off or "tuesday" in days_off: > doSomething > > I currently am tending to write: > > if any([d for d in ['monday', 'tuesday'] if d in days_off]): > doSomething > > Is there a better pythonic idiom for this situation? ... hmmm, try this: if set(['monday', 'tuesday'])&set(days_off): dosomething Regards Adam Przybyla -- http://mail.python.org/mailman/listinfo/python-list
- Re: Pythonic way of saying 'at least one... Paul Rubin
- Re: Pythonic way of saying 'at least... Xavier Ho
- Re: Pythonic way of saying 'at least... Carl Banks
- Re: Pythonic way of saying 'at least one of a, b,... Chris Kaynor
- Re: Pythonic way of saying 'at least one of a, b,... Arnaud Delobelle
- Re: Pythonic way of saying 'at least one of ... cbr...@cbrownsystems.com
- Re: Pythonic way of saying 'at least one of a, b,... HEK
- Re: Pythonic way of saying 'at least one of a, b,... Steven D'Aprano
- Re: Pythonic way of saying 'at least one of ... cbr...@cbrownsystems.com
- Re: Pythonic way of saying 'at least one of a, b,... Adam Przybyla