mardi 24 février 2015

Why every value is an object in python?


I know about writing programs (using C) that have:




  1. Data values, that are manipulated. For example: integer, float values etc..




  2. functions (rules), by which data values are manipulated.




object is a coherent abstraction of representing something that encompass it's properties(data values) + interactions (functions) && processes (functions) that can manipulate those data values.


As a python beginner, I would like to know, why data values (like integers and floats) and processes(like functions) are considered objects?


From Guido's blog as mentioned below, I could find some relevant information but does not answer why?



The internal implementation of Python made this simple to do. All of Python's objects were based on a common C data structure that was used everywhere in the interpreter. Variables, lists, functions, and everything else just used variations of this one data structure---it just didn't matter if the structure happened to represent a simple object such as an integer or something more complicated such as a class.



How can a computational process(function) be an object as per any language design?





Aucun commentaire:

Enregistrer un commentaire