How best to reference parameters.

Jay Parlar jparlar at cogeco.ca
Tue Oct 25 21:33:54 EDT 2005


On Oct 25, 2005, at 3:10 PM, David wrote:

>
> 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
> ...

FYI, for property to work, your class has to be newstyle, ie. 
inheriting from object:

class test(object):
   ... stuff...

The thing is, if you use property() with an old style class, no error 
will be raised, so you have to be careful.

Jay P.




More information about the Python-list mailing list