[Tutor] declaring private attributes...
Tue Apr 29 04:16:01 2003
On Wed, Apr 30, 2003 at 02:06:49AM +0800, x wrote:
> is there a way for me to declare private, protected or static class attributes (like java)???
Private, yes (sort of). See
for more info.
You can not create protected attributes in Python. Everything is public or
Static attributes (class attributes) are created by putting them immideately
after the "class <classname>":
>>> class A:
... sa = 1
>>> a = A()
>>> A.sa += 1
I'm not very familiar with java, but I'm guessing static attributes work
similar to this there.