python terminology on classes
Thomas Jollans
thomas at jollans.com
Mon Jul 26 19:15:08 EDT 2010
On 07/26/2010 11:52 PM, Peng Yu wrote:
> Hi
>
> I'm still kind of confused about the terminology on classes in python.
>
> Could you please let me know what the equivalent terms for the
> following C++ terms?
>
> constructor
constructor.
This consists of the class constructor method, __new__, and of the
instance initialization method, __init__
In practice, __init__ is really "the constructor".
http://docs.python.org/py3k/reference/datamodel.html#object.__new__
> destructor
destructor.
http://docs.python.org/py3k/reference/datamodel.html#object.__del__
> member function
method.
Look for "instance method" below
<URL:http://docs.python.org/py3k/reference/datamodel.html#the-standard-type-hierarchy>
> member variable
attribute, instance attribute, instance variable.
> virtual member function
all methods are virtual.
> function
function.
> I think that C++ "function" is equivalent to python "function" and C++
> "member function" is equivalent to python "method". But I couldn't
> locate where the original definitions of the corresponding python
> terms in the manual as these term appear many times. Could you please
> point me where to look for the definition of these python
> corresponding terms?
http://docs.python.org/py3k/reference/datamodel.html should answer all
your questions.
More information about the Python-list
mailing list