Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Python object creation sequence

[The Python version described in this article is 3.x]This article aims to explore the process of creating new objects in Python. As I explained in a previous article, object creation is just a special case of calling a callable. Consider this Python code:class Joe: passj = Joe()What happens when j = Joe() is executed? Python sees it as a call to the callable Joe, and routes it to the internal function PyObject_Call, with Joe passed as the first argument. PyObject_Call looks at the type of its first argument to extract its tp_call attribute.Now, what is the type of Joe? Whenever we define a ...

2,284 0       PYTHON OBJECT CREATION