How best to reference parameters.

David Poundall david at jotax.com
Tue Oct 25 17:56:47 EDT 2005


It looks like I am going to have to bite the bullet and use properties.
The following should do what I want.

class test:

    def __init__(self):
        self.__HB = 0
        self.__VPG = 0

    def _get_HB(self): return (self.__HB, 'MF1', 0)
    def _set_HB(self, x): self.__HB = x
    HB = property(_get_HB, _set_HB)

    def _get_VPG(self): return (self.__VPG, 'MF1', 1)
    def _set_VPG(self, x): self.__HB = x
    VPG = property(_get_VPG, _set_VPG)

Usisg this I can set / and clear HB and VPG usig the syntax

t = test()
t.HB = 1
t.VPG = 0

and when I read them I get a tuple which holds the currcnt value in
position 0 and the other parameters I need in positions 1 and 2.




More information about the Python-list mailing list