On 8/23/2010 1:09 PM, Gregory, Matthew wrote:
Bob Gailer wrote:
class PointND(list):
def __init__(self, *a_list):
super(PointND, self).__init__(a_list)
def getSet(ix):
def chklen(self):
if len(self)< ix + 1:
raise AttributeError
def get(self):
chklen(self)
return self[ix]
def set(self, value):
chklen(self)
self[ix] = value
return property(get, set)
def set(self, ix):
return s
x = getSet(0)
y = getSet(1)
z = getSet(2)
[snip]
Bob and Hugo, thanks for enlightening me to class properties. Obviously, I'm still on
the learning curve. Bob, I'm not seeing where the outer "def set(self, ix)" is
used. Am I missing something?
It should not be there! An accidental leftover.
But I notice other problems in my code which I am now attempting to fix.
Back to you seen.
--
Bob Gailer
919-636-4239
Chapel Hill NC
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor