SiteMap  | About    

Characteristics of Python Objects

All Python objects have a unique identity . The built-in function id() returns the identity of an object as an integer. This integer usually corresponds to the object's location in memory, although this is specific to the Python implementation and the platform being used. The "is" operator compares the identity of two objects.

A Python class defines a data type , which contains variables, properties and methods. A class describes the abstract characteristics of a real-life thing. As Python's Objects are instances of classes created at run-time.

Python Inheritance enable us to define a class that takes all the functionality from parent class and allows us to add more. Inheritance is used to specify that one class will get most or all of its features from its parent class . It is a feature of Object Oriented Programming.

Python Method overloading : In Python you can define a method in such a way that there are multiple ways to call it. The assignment of more than one behaviour to a particular function. Given a single method or function, we can specify the number of parameters ourselves. The operation performed varies by the types of objects or arguments involved.

Python represents all its data as objects . every object can be either mutable or immutable based on the type of data they hold. Some of these objects like lists and dictionaries are mutable , meaning you can change their content without changing their identity. Other objects like integers, floats, strings and tuples are objects that can not be changed.

Whenever an object is not being used in the code, it gets destroyed automatically garbage collected or destroyed. Garbage collection (not including reference counting), generally means traversing the object graph, marking any objects that are reached, and freeing ones that were never reached.

Python Operator overloading enables us to use mathematical, logical and bitwise operators on python objects just like any primitive data type. The operators are actually methods defined in respective classes. Defining methods for operators is known as operator overloading. (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.