On 6 December 2011 18:12, Ian Kelly <ian.g.ke...@gmail.com> wrote: > How about a class property? > > class classproperty(object): > def __init__(self, fget): > self.__fget = fget > def __get__(self, instance, owner): > return self.__fget(owner)
Nice :-) About as heavyweight as a classmethod, though, so it doesn't buy me much over that (beyond avoiding a set of parens, which isn't a big deal). Either classmethod or classproperty gives me the key benefit I'm after, which is avoiding the per-instance overhead, though. TBH, this is a huge case of premature optimisation, though, so it's probably little more than an academic or style question. :-) Paul -- http://mail.python.org/mailman/listinfo/python-list