[Tutor] Some help with properties and accessor functions....

Mark True darfoo at gmail.com
Wed Apr 19 18:46:27 CEST 2006


class SOFileIndexRecord(object):
    def __init__(self, so):
        self._so=so

    def _get_code(self):
        return self._so.code
    def _set_code(self, value):
        self._so.code=value
    testCode=property(_get_code, _set_code) # What does this do?

    def _get_fileName(self):
        return self._so.fileName
    def _set_fileName(self, value):
        self._so.fileName=value
    fileName=property(_get_fileName, _set_fileName) # What does this do?

I am playing with SQLobject, and I managed to cobble together some code for
it based on information in the FAQ but I am not understanding entirely what
I am doing....can someone help? I don't really understand what setting
properties does and how I access the defined get/set functions in this
object.

Any info would be wonderful, thanks in advance!
--Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060419/03776e05/attachment.htm 


More information about the Tutor mailing list