Hello All, I have been working on learning how to use python properties.
The get property access is working, but the the set property is not working. Rather then dispatching the property assignment to setNothing, the property object is being replaced with a string. I must be doing something very stupid here. Could someone please point out my error, I have dents in my forehead for this one. Thanks, Mike ------------------------------------------------------------------ from unittest import TestCase import unittest class Task: def __init__(self,command): self._command = command def setNothing(self, value): raise AttributeError def getCommand(self): return self._command command=property(getCommand, setNothing) class taskTest(TestCase): def testTask(self): t = Task("dir c:") c = t.command self.assertEquals("dir c:", c) # should fail, but doesn't t.command = "foo Bar" self.assertEquals("dir c:", t.command) if __name__ == "__main__": unittest.main() -- http://mail.python.org/mailman/listinfo/python-list