Marc 'BlackJack' Rintsch wrote:
On Mon, 25 Aug 2008 21:44:49 +0100, Ken Starks wrote:
####################
def __getattr__(self,attrname):
if attrname == 'gridsize':
return 0.8
def __setattr__(self,attrname,value):
if attrname == 'gridsize':
pass
else:
self.__dict__[attrname]=value
[…]
I admit I haven't used properties, and had to look them up. Pretty cool
indeed ! But an extra unnecessary level of complexity for my needs
here, I feel.
Compare this with your approach above and point out the extra complexity
please:
@property
def gridsize(self):
return 0.8
Ciao,
Marc 'BlackJack' Rintsch
mea culpa.
As i mentioned, I haven't used them before.
I have already changed my
class Foo: to class Foo(object):
and I'll do the rest tomorrow.
--
http://mail.python.org/mailman/listinfo/python-list