Re: A way to write properties

2012-01-24 Thread HEK
On Jan 23, 12:45 pm, Arnaud Delobelle wrote: > Hi all, > > It just occurred to me that there's a very simple but slightly > different way to implement properties: > > class PropertyType(type): >     def __get__(self, obj, objtype): >         return self if obj is None else self.get(obj) >     def

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-29 Thread HEK
On Oct 28, 6:16 pm, "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 be