TrashPanda Wiki
(Created page with "== Object Life-Cycle ==")
Tag: Visual edit
 
No edit summary
Line 1: Line 1:
 
== Object Life-Cycle ==
 
== Object Life-Cycle ==
  +
  +
  +
The lifecycle of an object mis made up of it's '''creation''', '''manipulation''', and '''destruction'''.
  +
  +
The stages of the object's lifecycle look like this:
  +
#'''Definition''' - The first stage, the definition of the class to which it belongs.
  +
#'''Instantiation''' - When ''__init__'' is called. Memory is allocated to store the instance.
  +
#'''"New" method''' - The ''__new__ ''method is called. This is usually overridden only in special cases.
  +
#'''Object ready''' - Now the object is ready to be used.

Revision as of 19:28, 20 May 2019

Object Life-Cycle

The lifecycle of an object mis made up of it's creationmanipulation, and destruction.

The stages of the object's lifecycle look like this:

  1. Definition - The first stage, the definition of the class to which it belongs.
  2. Instantiation - When __init__ is called. Memory is allocated to store the instance.
  3. "New" method - The __new__ method is called. This is usually overridden only in special cases.
  4. Object ready - Now the object is ready to be used.