[Q]Python Classes
Siew-Ann Cheong
cheong at msc.cornell.edu
Sun May 27 00:19:49 EDT 2001
Hi,
I am new to Python, but have been working with C/C++ for quite a well.
In C++, I am used to the construct:
class MyClass
{
public:
MyClass(int data)
{
private_data = data;
MyInitialization();
}
void MyInitialization()
{
...
}
private:
int private_data;
}
However, if I try to do the same thing in python,
class MyClass:
def __init__(self, data):
self.private_data = data
MyInitialization()
def MyInitialization(self):
...
I get complaints on MyInitialization().
Is this non-use of member functions within the class definition a Python
feature, or am I just doing it wrong?
Thanks!
Cheong Siew Ann
More information about the Python-list
mailing list