On 08-Jun-11 23:33, Ashwini Oruganti wrote:
On Thu, Jun 9, 2011 at 11:31 AM, Steve Willoughby <st...@alchemy.com
<mailto:st...@alchemy.com>> wrote:
The value 5 is an integer-class object.
But now what is "Integer-class"? Isn't integer a data type? I mean there
is no concept of "classes" in C, and yet in C, we can write
In Python, everything is an object, so integers are objects. In C,
integers are a fundamental data type. C doesn't have objects at all.
Classes are data types, too, though, (the combination of a data
representation and the set of behaviors that define what that data does
in your program).
int x = 5;
Will "5", then be called an integer class object?
In an object-oriented language, yes. In C, no, since it doesn't even
have classes.
What exactly is a class now? I thought is a collection of variables and
(or) associated functions. Am I missing something here?
But in an object oriented language such as Python, we have classes and
objects, and integers are just another class of data objects. In this
case, it's a very simple data structure with an associated set of
methods to do things like add integers together, compare them with each
other, etc.
--
Steve Willoughby / st...@alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor