Python language concepts
We'll introduce a few central concepts of the Python language before looking at more complex examples in later chapters. The first of the central concepts is that everything in Python is an object. Several popular languages have primitive types which escape the object-oriented nature of the language. Python doesn't have this feature. Even simple integers are objects, with defined methods.
Because everything is an object, we're assured of consistent behavior with no special cases. In some languages, the ==
operator works in one way for primitive types and in another way for objects. Python lacks this divergent behavior. All built-in classes implement the ==
operator consistently; unless we make specific (and pathological) ...
Get Python Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.