[Tutor] Class: property? function list?
Run-Sun Pan
runsun@bilbo.bio.purdue.edu
Mon, 1 Oct 2001 02:38:53 -0500 (EST)
Dear all,
[1] --- "property" in class ???
Is there any "property" in class? For example,
mc = myclass()
mc.hitcount = 100 #<===== user input
x = mc.hitcount
print x
In the above example there's no validation
whatsoever. As long as the 100 is passed to
.hitcount, no matter it's a string or even
other object type, it will be past to x.
I want to have this .hitcount value validated
before it is returned to other variable x. In
some other object-oriented languages you can
define "properties" for a class for this purpose.
Is there such device in python ?
[2] --- list all variables and functions of
myclass
Is there a way to get a list of all the "names"
of all the variable and function names of my
own class ?
Thx in advance.
pan