[Tutor] Objects C++ vs Python

Ashwini Oruganti msg.ashwini at gmail.com
Thu Jun 9 07:38:04 CEST 2011


I'm trying to learn Python, and know C++. I have a slight confusion
regarding the meaning of "object" in python. Here's what I've concluded so
far:

When we say "object" in C++, it means an instance of a class.
e.g.

class x{.......};
x ob1;             // here ob1 is an object.

but, for;

   int x;                // x is NOT  an object, it is a *variable*



while in python, from what i've understood so far,
>>> x=5
implies that there's a memory allocation (called object) that holds the
value 3, and "x" is the variable (or name) that is used to refer to it.

Further, in python,  *everything *is an object, while in C++,
only*instances of a class
* are called objects.

So does the term *Object * change its meaning when we shift the context from
C++ to python?? This is a little confusing, can someone clear it up??



-- 
Regards,
Ashwini
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110609/dafb7e0b/attachment.html>


More information about the Tutor mailing list