[{"data":1,"prerenderedAt":2134},["ShallowReactive",2],{"doc-\u002Fhow-to\u002Fhow-to-create-an-object-in-python":3},{"id":4,"title":5,"body":6,"description":2127,"extension":2128,"meta":2129,"navigation":122,"path":2130,"seo":2131,"stem":2132,"__hash__":2133},"content\u002Fhow-to\u002Fhow-to-create-an-object-in-python.md","How to Create an Object in Python",{"type":7,"value":8,"toc":2095},"minimark",[9,13,17,20,36,41,168,171,180,183,187,199,203,210,217,228,231,245,258,262,265,293,296,365,368,390,394,397,466,469,520,523,537,540,555,563,569,572,577,703,705,720,723,756,759,786,789,799,803,806,813,818,898,900,909,913,1030,1032,1053,1056,1076,1088,1092,1095,1099,1102,1146,1152,1155,1200,1204,1259,1265,1267,1290,1300,1307,1309,1346,1348,1389,1394,1398,1400,1481,1484,1488,1512,1516,1522,1525,1528,1539,1542,1565,1569,1572,1627,1630,1656,1659,1754,1756,1799,1803,1807,1810,1817,1826,1830,1833,1835,1953,1955,1969,1977,1983,1986,2046,2052,2056,2088,2091],[10,11,5],"h1",{"id":12},"how-to-create-an-object-in-python",[14,15,16],"p",{},"To create an object in Python, you first define a class, then call the class name like a function.",[14,18,19],{},"This page shows you how to:",[21,22,23,27,30,33],"ul",{},[24,25,26],"li",{},"Create an object from a class",[24,28,29],{},"Understand the difference between the class name and the object variable",[24,31,32],{},"Pass starting values when creating an object",[24,34,35],{},"Use the object's data and methods right away",[37,38,40],"h2",{"id":39},"quick-answer","Quick answer",[42,43,48],"pre",{"className":44,"code":45,"language":46,"meta":47,"style":47},"language-python shiki shiki-themes material-theme-lighter github-light github-dark","class Dog:\n    def __init__(self, name):\n        self.name = name\n\nmy_dog = Dog(\"Max\")\nprint(my_dog.name)\n","python","",[49,50,51,68,95,117,124,151],"code",{"__ignoreMap":47},[52,53,56,60,64],"span",{"class":54,"line":55},"line",1,[52,57,59],{"class":58},"sbsja","class",[52,61,63],{"class":62},"sbgvK"," Dog",[52,65,67],{"class":66},"sP7_E",":\n",[52,69,71,74,78,81,85,88,92],{"class":54,"line":70},2,[52,72,73],{"class":58},"    def",[52,75,77],{"class":76},"sptTA"," __init__",[52,79,80],{"class":66},"(",[52,82,84],{"class":83},"smCYv","self",[52,86,87],{"class":66},",",[52,89,91],{"class":90},"sFwrP"," name",[52,93,94],{"class":66},"):\n",[52,96,98,102,105,109,113],{"class":54,"line":97},3,[52,99,101],{"class":100},"s_hVV","        self",[52,103,104],{"class":66},".",[52,106,108],{"class":107},"skxfh","name",[52,110,112],{"class":111},"smGrS"," =",[52,114,116],{"class":115},"su5hD"," name\n",[52,118,120],{"class":54,"line":119},4,[52,121,123],{"emptyLinePlaceholder":122},true,"\n",[52,125,127,130,133,136,138,142,146,148],{"class":54,"line":126},5,[52,128,129],{"class":115},"my_dog ",[52,131,132],{"class":111},"=",[52,134,63],{"class":135},"slqww",[52,137,80],{"class":66},[52,139,141],{"class":140},"sjJ54","\"",[52,143,145],{"class":144},"s_sjI","Max",[52,147,141],{"class":140},[52,149,150],{"class":66},")\n",[52,152,154,157,159,162,164,166],{"class":54,"line":153},6,[52,155,156],{"class":76},"print",[52,158,80],{"class":66},[52,160,161],{"class":135},"my_dog",[52,163,104],{"class":66},[52,165,108],{"class":107},[52,167,150],{"class":66},[14,169,170],{},"Output:",[42,172,174],{"className":44,"code":173,"language":46,"meta":47,"style":47},"Max\n",[49,175,176],{"__ignoreMap":47},[52,177,178],{"class":54,"line":55},[52,179,173],{"class":115},[14,181,182],{},"Create a class, call the class name like a function, and store the new object in a variable.",[37,184,186],{"id":185},"what-this-page-helps-you-do","What this page helps you do",[21,188,189,191,194,196],{},[24,190,26],{},[24,192,193],{},"Understand the class name vs the object variable",[24,195,32],{},[24,197,198],{},"Use the object's data and methods",[37,200,202],{"id":201},"what-an-object-is-in-simple-terms","What an object is in simple terms",[14,204,205,206,209],{},"A ",[207,208,59],"strong",{}," is a blueprint.",[14,211,212,213,216],{},"An ",[207,214,215],{},"object"," is one real thing created from that blueprint.",[14,218,219,220,223,224,227],{},"For example, if ",[49,221,222],{},"Dog"," is a class, then ",[49,225,226],{},"Dog(\"Max\")"," creates one dog object.",[14,229,230],{},"Important ideas:",[21,232,233,236,239,242],{},[24,234,235],{},"A class is a blueprint",[24,237,238],{},"An object is one real item made from that blueprint",[24,240,241],{},"You can create many objects from the same class",[24,243,244],{},"Each object can store its own values",[14,246,247,248,253,254,104],{},"If you want a deeper explanation, see ",[249,250,252],"a",{"href":251},"\u002Flearn\u002Fpython-classes-and-objects-explained","Python classes and objects explained"," or ",[249,255,257],{"href":256},"\u002Fglossary\u002Fwhat-is-an-object-in-python","what an object is in Python",[37,259,261],{"id":260},"basic-steps-to-create-an-object","Basic steps to create an object",[14,263,264],{},"The usual process is:",[266,267,268,274,281,287],"ol",{},[24,269,270,271],{},"Define a class with ",[49,272,273],{},"class ClassName:",[24,275,276,277,280],{},"Optionally add ",[49,278,279],{},"__init__"," to set starting values",[24,282,283,284],{},"Create the object with ",[49,285,286],{},"ClassName(...)",[24,288,289,290],{},"Save it in a variable like ",[49,291,292],{},"user = User(...)",[14,294,295],{},"Here is the general pattern:",[42,297,299],{"className":44,"code":298,"language":46,"meta":47,"style":47},"class ClassName:\n    def __init__(self, value):\n        self.value = value\n\nmy_object = ClassName(\"example\")\n",[49,300,301,310,327,341,345],{"__ignoreMap":47},[52,302,303,305,308],{"class":54,"line":55},[52,304,59],{"class":58},[52,306,307],{"class":62}," ClassName",[52,309,67],{"class":66},[52,311,312,314,316,318,320,322,325],{"class":54,"line":70},[52,313,73],{"class":58},[52,315,77],{"class":76},[52,317,80],{"class":66},[52,319,84],{"class":83},[52,321,87],{"class":66},[52,323,324],{"class":90}," value",[52,326,94],{"class":66},[52,328,329,331,333,336,338],{"class":54,"line":97},[52,330,101],{"class":100},[52,332,104],{"class":66},[52,334,335],{"class":107},"value",[52,337,112],{"class":111},[52,339,340],{"class":115}," value\n",[52,342,343],{"class":54,"line":119},[52,344,123],{"emptyLinePlaceholder":122},[52,346,347,350,352,354,356,358,361,363],{"class":54,"line":126},[52,348,349],{"class":115},"my_object ",[52,351,132],{"class":111},[52,353,307],{"class":135},[52,355,80],{"class":66},[52,357,141],{"class":140},[52,359,360],{"class":144},"example",[52,362,141],{"class":140},[52,364,150],{"class":66},[14,366,367],{},"In this code:",[21,369,370,376,382],{},[24,371,372,375],{},[49,373,374],{},"ClassName"," is the class",[24,377,378,381],{},[49,379,380],{},"my_object"," is the variable that stores the new object",[24,383,384,387,388],{},[49,385,386],{},"\"example\""," is passed into ",[49,389,279],{},[37,391,393],{"id":392},"create-an-object-without-starting-values","Create an object without starting values",[14,395,396],{},"This is the simplest possible example.",[42,398,400],{"className":44,"code":399,"language":46,"meta":47,"style":47},"class Car:\n    pass\n\nmy_car = Car()\n\nprint(type(my_car))\nprint(my_car)\n",[49,401,402,411,417,421,433,437,455],{"__ignoreMap":47},[52,403,404,406,409],{"class":54,"line":55},[52,405,59],{"class":58},[52,407,408],{"class":62}," Car",[52,410,67],{"class":66},[52,412,413],{"class":54,"line":70},[52,414,416],{"class":415},"sVHd0","    pass\n",[52,418,419],{"class":54,"line":97},[52,420,123],{"emptyLinePlaceholder":122},[52,422,423,426,428,430],{"class":54,"line":119},[52,424,425],{"class":115},"my_car ",[52,427,132],{"class":111},[52,429,408],{"class":135},[52,431,432],{"class":66},"()\n",[52,434,435],{"class":54,"line":126},[52,436,123],{"emptyLinePlaceholder":122},[52,438,439,441,443,447,449,452],{"class":54,"line":153},[52,440,156],{"class":76},[52,442,80],{"class":66},[52,444,446],{"class":445},"sZMiF","type",[52,448,80],{"class":66},[52,450,451],{"class":135},"my_car",[52,453,454],{"class":66},"))\n",[52,456,458,460,462,464],{"class":54,"line":457},7,[52,459,156],{"class":76},[52,461,80],{"class":66},[52,463,451],{"class":135},[52,465,150],{"class":66},[14,467,468],{},"Possible output:",[42,470,472],{"className":44,"code":471,"language":46,"meta":47,"style":47},"\u003Cclass '__main__.Car'>\n\u003C__main__.Car object at 0x...>\n",[49,473,474,493],{"__ignoreMap":47},[52,475,476,479,481,484,487,490],{"class":54,"line":55},[52,477,478],{"class":111},"\u003C",[52,480,59],{"class":58},[52,482,483],{"class":140}," '",[52,485,486],{"class":144},"__main__.Car",[52,488,489],{"class":140},"'",[52,491,492],{"class":111},">\n",[52,494,495,497,500,502,505,508,511,515,518],{"class":54,"line":70},[52,496,478],{"class":111},[52,498,499],{"class":115},"__main__",[52,501,104],{"class":66},[52,503,504],{"class":107},"Car",[52,506,507],{"class":445}," object",[52,509,510],{"class":115}," at ",[52,512,514],{"class":513},"srjyR","0x",[52,516,517],{"class":100},"...",[52,519,492],{"class":111},[14,521,522],{},"Why this example helps:",[21,524,525,531,534],{},[24,526,527,528],{},"The class can be empty except for ",[49,529,530],{},"pass",[24,532,533],{},"You still create the object by calling the class name",[24,535,536],{},"It shows the object creation step clearly",[14,538,539],{},"The important line is:",[42,541,543],{"className":44,"code":542,"language":46,"meta":47,"style":47},"my_car = Car()\n",[49,544,545],{"__ignoreMap":47},[52,546,547,549,551,553],{"class":54,"line":55},[52,548,425],{"class":115},[52,550,132],{"class":111},[52,552,408],{"class":135},[52,554,432],{"class":66},[14,556,557,558,560,561,104],{},"That creates one ",[49,559,504],{}," object and stores it in ",[49,562,451],{},[37,564,566,567],{"id":565},"create-an-object-with-__init__","Create an object with ",[49,568,279],{},[14,570,571],{},"Most of the time, you will want to give the object some starting data.",[14,573,574,576],{},[49,575,279],{}," is a special method that runs automatically when the object is created.",[42,578,580],{"className":44,"code":579,"language":46,"meta":47,"style":47},"class Person:\n    def __init__(self, name, age):\n        self.name = name\n        self.age = age\n\nperson1 = Person(\"Ana\", 30)\n\nprint(person1.name)\nprint(person1.age)\n",[49,581,582,591,612,624,638,642,668,672,688],{"__ignoreMap":47},[52,583,584,586,589],{"class":54,"line":55},[52,585,59],{"class":58},[52,587,588],{"class":62}," Person",[52,590,67],{"class":66},[52,592,593,595,597,599,601,603,605,607,610],{"class":54,"line":70},[52,594,73],{"class":58},[52,596,77],{"class":76},[52,598,80],{"class":66},[52,600,84],{"class":83},[52,602,87],{"class":66},[52,604,91],{"class":90},[52,606,87],{"class":66},[52,608,609],{"class":90}," age",[52,611,94],{"class":66},[52,613,614,616,618,620,622],{"class":54,"line":97},[52,615,101],{"class":100},[52,617,104],{"class":66},[52,619,108],{"class":107},[52,621,112],{"class":111},[52,623,116],{"class":115},[52,625,626,628,630,633,635],{"class":54,"line":119},[52,627,101],{"class":100},[52,629,104],{"class":66},[52,631,632],{"class":107},"age",[52,634,112],{"class":111},[52,636,637],{"class":115}," age\n",[52,639,640],{"class":54,"line":126},[52,641,123],{"emptyLinePlaceholder":122},[52,643,644,647,649,651,653,655,658,660,662,666],{"class":54,"line":153},[52,645,646],{"class":115},"person1 ",[52,648,132],{"class":111},[52,650,588],{"class":135},[52,652,80],{"class":66},[52,654,141],{"class":140},[52,656,657],{"class":144},"Ana",[52,659,141],{"class":140},[52,661,87],{"class":66},[52,663,665],{"class":664},"srdBf"," 30",[52,667,150],{"class":66},[52,669,670],{"class":54,"line":457},[52,671,123],{"emptyLinePlaceholder":122},[52,673,675,677,679,682,684,686],{"class":54,"line":674},8,[52,676,156],{"class":76},[52,678,80],{"class":66},[52,680,681],{"class":135},"person1",[52,683,104],{"class":66},[52,685,108],{"class":107},[52,687,150],{"class":66},[52,689,691,693,695,697,699,701],{"class":54,"line":690},9,[52,692,156],{"class":76},[52,694,80],{"class":66},[52,696,681],{"class":135},[52,698,104],{"class":66},[52,700,632],{"class":107},[52,702,150],{"class":66},[14,704,170],{},[42,706,708],{"className":44,"code":707,"language":46,"meta":47,"style":47},"Ana\n30\n",[49,709,710,715],{"__ignoreMap":47},[52,711,712],{"class":54,"line":55},[52,713,714],{"class":115},"Ana\n",[52,716,717],{"class":54,"line":70},[52,718,719],{"class":664},"30\n",[14,721,722],{},"What is happening here:",[21,724,725,734,739,747],{},[24,726,727,729,730,733],{},[49,728,279],{}," runs when ",[49,731,732],{},"Person(\"Ana\", 30)"," is called",[24,735,736,738],{},[49,737,84],{}," refers to the object being created",[24,740,741,743,744,746],{},[49,742,108],{}," and ",[49,745,632],{}," receive the values you pass in",[24,748,749,743,752,755],{},[49,750,751],{},"self.name",[49,753,754],{},"self.age"," store those values in the object",[14,757,758],{},"So this line:",[42,760,762],{"className":44,"code":761,"language":46,"meta":47,"style":47},"person1 = Person(\"Ana\", 30)\n",[49,763,764],{"__ignoreMap":47},[52,765,766,768,770,772,774,776,778,780,782,784],{"class":54,"line":55},[52,767,646],{"class":115},[52,769,132],{"class":111},[52,771,588],{"class":135},[52,773,80],{"class":66},[52,775,141],{"class":140},[52,777,657],{"class":144},[52,779,141],{"class":140},[52,781,87],{"class":66},[52,783,665],{"class":664},[52,785,150],{"class":66},[14,787,788],{},"creates the object and gives it starting values.",[14,790,791,792,104],{},"If you want to learn more about this method, see ",[249,793,795,796,798],{"href":794},"\u002Flearn\u002Fthe-__init__-method-in-python-explained","the ",[49,797,279],{}," method in Python explained",[37,800,802],{"id":801},"access-object-data-and-methods","Access object data and methods",[14,804,805],{},"After creating an object, you usually want to use its data or call its methods.",[14,807,808,809,812],{},"Use ",[207,810,811],{},"dot notation"," for both.",[814,815,817],"h3",{"id":816},"access-data","Access data",[42,819,821],{"className":44,"code":820,"language":46,"meta":47,"style":47},"class Person:\n    def __init__(self, name):\n        self.name = name\n\nperson = Person(\"Lina\")\nprint(person.name)\n",[49,822,823,831,847,859,863,883],{"__ignoreMap":47},[52,824,825,827,829],{"class":54,"line":55},[52,826,59],{"class":58},[52,828,588],{"class":62},[52,830,67],{"class":66},[52,832,833,835,837,839,841,843,845],{"class":54,"line":70},[52,834,73],{"class":58},[52,836,77],{"class":76},[52,838,80],{"class":66},[52,840,84],{"class":83},[52,842,87],{"class":66},[52,844,91],{"class":90},[52,846,94],{"class":66},[52,848,849,851,853,855,857],{"class":54,"line":97},[52,850,101],{"class":100},[52,852,104],{"class":66},[52,854,108],{"class":107},[52,856,112],{"class":111},[52,858,116],{"class":115},[52,860,861],{"class":54,"line":119},[52,862,123],{"emptyLinePlaceholder":122},[52,864,865,868,870,872,874,876,879,881],{"class":54,"line":126},[52,866,867],{"class":115},"person ",[52,869,132],{"class":111},[52,871,588],{"class":135},[52,873,80],{"class":66},[52,875,141],{"class":140},[52,877,878],{"class":144},"Lina",[52,880,141],{"class":140},[52,882,150],{"class":66},[52,884,885,887,889,892,894,896],{"class":54,"line":153},[52,886,156],{"class":76},[52,888,80],{"class":66},[52,890,891],{"class":135},"person",[52,893,104],{"class":66},[52,895,108],{"class":107},[52,897,150],{"class":66},[14,899,170],{},[42,901,903],{"className":44,"code":902,"language":46,"meta":47,"style":47},"Lina\n",[49,904,905],{"__ignoreMap":47},[52,906,907],{"class":54,"line":55},[52,908,902],{"class":115},[814,910,912],{"id":911},"call-a-method","Call a method",[42,914,916],{"className":44,"code":915,"language":46,"meta":47,"style":47},"class Person:\n    def __init__(self, name):\n        self.name = name\n\n    def say_hello(self):\n        print(\"Hello, my name is\", self.name)\n\nperson = Person(\"Lina\")\nperson.say_hello()\n",[49,917,918,926,942,954,958,972,997,1001,1019],{"__ignoreMap":47},[52,919,920,922,924],{"class":54,"line":55},[52,921,59],{"class":58},[52,923,588],{"class":62},[52,925,67],{"class":66},[52,927,928,930,932,934,936,938,940],{"class":54,"line":70},[52,929,73],{"class":58},[52,931,77],{"class":76},[52,933,80],{"class":66},[52,935,84],{"class":83},[52,937,87],{"class":66},[52,939,91],{"class":90},[52,941,94],{"class":66},[52,943,944,946,948,950,952],{"class":54,"line":97},[52,945,101],{"class":100},[52,947,104],{"class":66},[52,949,108],{"class":107},[52,951,112],{"class":111},[52,953,116],{"class":115},[52,955,956],{"class":54,"line":119},[52,957,123],{"emptyLinePlaceholder":122},[52,959,960,962,966,968,970],{"class":54,"line":126},[52,961,73],{"class":58},[52,963,965],{"class":964},"sGLFI"," say_hello",[52,967,80],{"class":66},[52,969,84],{"class":83},[52,971,94],{"class":66},[52,973,974,977,979,981,984,986,988,991,993,995],{"class":54,"line":153},[52,975,976],{"class":76},"        print",[52,978,80],{"class":66},[52,980,141],{"class":140},[52,982,983],{"class":144},"Hello, my name is",[52,985,141],{"class":140},[52,987,87],{"class":66},[52,989,990],{"class":100}," self",[52,992,104],{"class":66},[52,994,108],{"class":107},[52,996,150],{"class":66},[52,998,999],{"class":54,"line":457},[52,1000,123],{"emptyLinePlaceholder":122},[52,1002,1003,1005,1007,1009,1011,1013,1015,1017],{"class":54,"line":674},[52,1004,867],{"class":115},[52,1006,132],{"class":111},[52,1008,588],{"class":135},[52,1010,80],{"class":66},[52,1012,141],{"class":140},[52,1014,878],{"class":144},[52,1016,141],{"class":140},[52,1018,150],{"class":66},[52,1020,1021,1023,1025,1028],{"class":54,"line":690},[52,1022,891],{"class":115},[52,1024,104],{"class":66},[52,1026,1027],{"class":135},"say_hello",[52,1029,432],{"class":66},[14,1031,170],{},[42,1033,1035],{"className":44,"code":1034,"language":46,"meta":47,"style":47},"Hello, my name is Lina\n",[49,1036,1037],{"__ignoreMap":47},[52,1038,1039,1042,1044,1047,1050],{"class":54,"line":55},[52,1040,1041],{"class":115},"Hello",[52,1043,87],{"class":66},[52,1045,1046],{"class":115}," my name ",[52,1048,1049],{"class":111},"is",[52,1051,1052],{"class":115}," Lina\n",[14,1054,1055],{},"Key points:",[21,1057,1058,1064,1070,1073],{},[24,1059,1060,1061],{},"Use dot notation like ",[49,1062,1063],{},"person.name",[24,1065,1066,1067],{},"Call methods with dot notation like ",[49,1068,1069],{},"person.say_hello()",[24,1071,1072],{},"Each object keeps its own attribute values",[24,1074,1075],{},"The object variable points to that specific object",[14,1077,1078,1079,1083,1084,104],{},"If you want to build your own class first, see ",[249,1080,1082],{"href":1081},"\u002Fhow-to\u002Fhow-to-create-a-class-in-python\u002F","how to create a class in Python",". If you want objects to do more, see ",[249,1085,1087],{"href":1086},"\u002Fhow-to\u002Fhow-to-add-methods-to-a-class-in-python\u002F","how to add methods to a class in Python",[37,1089,1091],{"id":1090},"common-beginner-mistakes","Common beginner mistakes",[14,1093,1094],{},"These are some common problems when creating objects in Python.",[814,1096,1098],{"id":1097},"forgetting-parentheses","Forgetting parentheses",[14,1100,1101],{},"Wrong:",[42,1103,1105],{"className":44,"code":1104,"language":46,"meta":47,"style":47},"class Dog:\n    pass\n\nmy_dog = Dog\nprint(type(my_dog))\n",[49,1106,1107,1115,1119,1123,1132],{"__ignoreMap":47},[52,1108,1109,1111,1113],{"class":54,"line":55},[52,1110,59],{"class":58},[52,1112,63],{"class":62},[52,1114,67],{"class":66},[52,1116,1117],{"class":54,"line":70},[52,1118,416],{"class":415},[52,1120,1121],{"class":54,"line":97},[52,1122,123],{"emptyLinePlaceholder":122},[52,1124,1125,1127,1129],{"class":54,"line":119},[52,1126,129],{"class":115},[52,1128,132],{"class":111},[52,1130,1131],{"class":115}," Dog\n",[52,1133,1134,1136,1138,1140,1142,1144],{"class":54,"line":126},[52,1135,156],{"class":76},[52,1137,80],{"class":66},[52,1139,446],{"class":445},[52,1141,80],{"class":66},[52,1143,161],{"class":135},[52,1145,454],{"class":66},[14,1147,1148,1149,1151],{},"Here, ",[49,1150,161],{}," refers to the class itself, not an object.",[14,1153,1154],{},"Correct:",[42,1156,1158],{"className":44,"code":1157,"language":46,"meta":47,"style":47},"class Dog:\n    pass\n\nmy_dog = Dog()\nprint(type(my_dog))\n",[49,1159,1160,1168,1172,1176,1186],{"__ignoreMap":47},[52,1161,1162,1164,1166],{"class":54,"line":55},[52,1163,59],{"class":58},[52,1165,63],{"class":62},[52,1167,67],{"class":66},[52,1169,1170],{"class":54,"line":70},[52,1171,416],{"class":415},[52,1173,1174],{"class":54,"line":97},[52,1175,123],{"emptyLinePlaceholder":122},[52,1177,1178,1180,1182,1184],{"class":54,"line":119},[52,1179,129],{"class":115},[52,1181,132],{"class":111},[52,1183,63],{"class":135},[52,1185,432],{"class":66},[52,1187,1188,1190,1192,1194,1196,1198],{"class":54,"line":126},[52,1189,156],{"class":76},[52,1191,80],{"class":66},[52,1193,446],{"class":445},[52,1195,80],{"class":66},[52,1197,161],{"class":135},[52,1199,454],{"class":66},[814,1201,1203],{"id":1202},"passing-the-wrong-number-of-arguments","Passing the wrong number of arguments",[42,1205,1207],{"className":44,"code":1206,"language":46,"meta":47,"style":47},"class Dog:\n    def __init__(self, name):\n        self.name = name\n\nmy_dog = Dog()\n",[49,1208,1209,1217,1233,1245,1249],{"__ignoreMap":47},[52,1210,1211,1213,1215],{"class":54,"line":55},[52,1212,59],{"class":58},[52,1214,63],{"class":62},[52,1216,67],{"class":66},[52,1218,1219,1221,1223,1225,1227,1229,1231],{"class":54,"line":70},[52,1220,73],{"class":58},[52,1222,77],{"class":76},[52,1224,80],{"class":66},[52,1226,84],{"class":83},[52,1228,87],{"class":66},[52,1230,91],{"class":90},[52,1232,94],{"class":66},[52,1234,1235,1237,1239,1241,1243],{"class":54,"line":97},[52,1236,101],{"class":100},[52,1238,104],{"class":66},[52,1240,108],{"class":107},[52,1242,112],{"class":111},[52,1244,116],{"class":115},[52,1246,1247],{"class":54,"line":119},[52,1248,123],{"emptyLinePlaceholder":122},[52,1250,1251,1253,1255,1257],{"class":54,"line":126},[52,1252,129],{"class":115},[52,1254,132],{"class":111},[52,1256,63],{"class":135},[52,1258,432],{"class":66},[14,1260,1261,1262,1264],{},"This causes an error because ",[49,1263,108],{}," is required.",[14,1266,1154],{},[42,1268,1270],{"className":44,"code":1269,"language":46,"meta":47,"style":47},"my_dog = Dog(\"Max\")\n",[49,1271,1272],{"__ignoreMap":47},[52,1273,1274,1276,1278,1280,1282,1284,1286,1288],{"class":54,"line":55},[52,1275,129],{"class":115},[52,1277,132],{"class":111},[52,1279,63],{"class":135},[52,1281,80],{"class":66},[52,1283,141],{"class":140},[52,1285,145],{"class":144},[52,1287,141],{"class":140},[52,1289,150],{"class":66},[14,1291,1292,1293,104],{},"If you see this kind of problem, read ",[249,1294,1296,1297],{"href":1295},"\u002Ferrors\u002Ftypeerror-missing-required-positional-argument-fix","how to fix ",[49,1298,1299],{},"TypeError: missing required positional argument",[814,1301,1303,1304,1306],{"id":1302},"forgetting-self-inside-class-methods","Forgetting ",[49,1305,84],{}," inside class methods",[14,1308,1101],{},[42,1310,1312],{"className":44,"code":1311,"language":46,"meta":47,"style":47},"class Dog:\n    def __init__(name):\n        self.name = name\n",[49,1313,1314,1322,1334],{"__ignoreMap":47},[52,1315,1316,1318,1320],{"class":54,"line":55},[52,1317,59],{"class":58},[52,1319,63],{"class":62},[52,1321,67],{"class":66},[52,1323,1324,1326,1328,1330,1332],{"class":54,"line":70},[52,1325,73],{"class":58},[52,1327,77],{"class":76},[52,1329,80],{"class":66},[52,1331,108],{"class":90},[52,1333,94],{"class":66},[52,1335,1336,1338,1340,1342,1344],{"class":54,"line":97},[52,1337,101],{"class":100},[52,1339,104],{"class":66},[52,1341,108],{"class":107},[52,1343,112],{"class":111},[52,1345,116],{"class":115},[14,1347,1154],{},[42,1349,1351],{"className":44,"code":1350,"language":46,"meta":47,"style":47},"class Dog:\n    def __init__(self, name):\n        self.name = name\n",[49,1352,1353,1361,1377],{"__ignoreMap":47},[52,1354,1355,1357,1359],{"class":54,"line":55},[52,1356,59],{"class":58},[52,1358,63],{"class":62},[52,1360,67],{"class":66},[52,1362,1363,1365,1367,1369,1371,1373,1375],{"class":54,"line":70},[52,1364,73],{"class":58},[52,1366,77],{"class":76},[52,1368,80],{"class":66},[52,1370,84],{"class":83},[52,1372,87],{"class":66},[52,1374,91],{"class":90},[52,1376,94],{"class":66},[52,1378,1379,1381,1383,1385,1387],{"class":54,"line":97},[52,1380,101],{"class":100},[52,1382,104],{"class":66},[52,1384,108],{"class":107},[52,1386,112],{"class":111},[52,1388,116],{"class":115},[14,1390,1391,1392,104],{},"Inside instance methods, the first parameter should usually be ",[49,1393,84],{},[814,1395,1397],{"id":1396},"using-a-variable-before-assigning-the-object","Using a variable before assigning the object",[14,1399,1101],{},[42,1401,1403],{"className":44,"code":1402,"language":46,"meta":47,"style":47},"print(my_dog.name)\n\nclass Dog:\n    def __init__(self, name):\n        self.name = name\n\nmy_dog = Dog(\"Max\")\n",[49,1404,1405,1419,1423,1431,1447,1459,1463],{"__ignoreMap":47},[52,1406,1407,1409,1411,1413,1415,1417],{"class":54,"line":55},[52,1408,156],{"class":76},[52,1410,80],{"class":66},[52,1412,161],{"class":135},[52,1414,104],{"class":66},[52,1416,108],{"class":107},[52,1418,150],{"class":66},[52,1420,1421],{"class":54,"line":70},[52,1422,123],{"emptyLinePlaceholder":122},[52,1424,1425,1427,1429],{"class":54,"line":97},[52,1426,59],{"class":58},[52,1428,63],{"class":62},[52,1430,67],{"class":66},[52,1432,1433,1435,1437,1439,1441,1443,1445],{"class":54,"line":119},[52,1434,73],{"class":58},[52,1436,77],{"class":76},[52,1438,80],{"class":66},[52,1440,84],{"class":83},[52,1442,87],{"class":66},[52,1444,91],{"class":90},[52,1446,94],{"class":66},[52,1448,1449,1451,1453,1455,1457],{"class":54,"line":126},[52,1450,101],{"class":100},[52,1452,104],{"class":66},[52,1454,108],{"class":107},[52,1456,112],{"class":111},[52,1458,116],{"class":115},[52,1460,1461],{"class":54,"line":153},[52,1462,123],{"emptyLinePlaceholder":122},[52,1464,1465,1467,1469,1471,1473,1475,1477,1479],{"class":54,"line":457},[52,1466,129],{"class":115},[52,1468,132],{"class":111},[52,1470,63],{"class":135},[52,1472,80],{"class":66},[52,1474,141],{"class":140},[52,1476,145],{"class":144},[52,1478,141],{"class":140},[52,1480,150],{"class":66},[14,1482,1483],{},"Create the object first, then use it.",[814,1485,1487],{"id":1486},"other-common-causes","Other common causes",[21,1489,1490,1493,1503,1509],{},[24,1491,1492],{},"Trying to use a class before defining it",[24,1494,1495,1496,1499,1500],{},"Writing ",[49,1497,1498],{},"object = ClassName"," instead of ",[49,1501,1502],{},"object = ClassName()",[24,1504,1505,1506,1508],{},"Defining ",[49,1507,279],{}," with parameters but not passing values",[24,1510,1511],{},"Misspelling the class name when creating the object",[37,1513,1515],{"id":1514},"how-this-page-differs-from-related-pages","How this page differs from related pages",[14,1517,1518,1519,104],{},"This page focuses on the task of ",[207,1520,1521],{},"creating an object",[14,1523,1524],{},"It does not try to fully explain all class design.",[14,1526,1527],{},"It stays practical and action-focused:",[21,1529,1530,1533,1536],{},[24,1531,1532],{},"Create an object",[24,1534,1535],{},"Pass values into it",[24,1537,1538],{},"Use its attributes and methods",[14,1540,1541],{},"For deeper learning, use these related pages:",[21,1543,1544,1548,1555,1560],{},[24,1545,1546],{},[249,1547,252],{"href":251},[24,1549,1550],{},[249,1551,1552,1553,798],{"href":794},"The ",[49,1554,279],{},[24,1556,1557],{},[249,1558,1559],{"href":1081},"How to create a class in Python",[24,1561,1562],{},[249,1563,1564],{"href":1086},"How to add methods to a class in Python",[37,1566,1568],{"id":1567},"helpful-debugging-checks","Helpful debugging checks",[14,1570,1571],{},"If object creation is not working, these quick checks can help:",[42,1573,1575],{"className":44,"code":1574,"language":46,"meta":47,"style":47},"print(type(my_object))\nprint(my_object)\nprint(my_object.__dict__)\nhelp(ClassName)\n",[49,1576,1577,1591,1601,1616],{"__ignoreMap":47},[52,1578,1579,1581,1583,1585,1587,1589],{"class":54,"line":55},[52,1580,156],{"class":76},[52,1582,80],{"class":66},[52,1584,446],{"class":445},[52,1586,80],{"class":66},[52,1588,380],{"class":135},[52,1590,454],{"class":66},[52,1592,1593,1595,1597,1599],{"class":54,"line":70},[52,1594,156],{"class":76},[52,1596,80],{"class":66},[52,1598,380],{"class":135},[52,1600,150],{"class":66},[52,1602,1603,1605,1607,1609,1611,1614],{"class":54,"line":97},[52,1604,156],{"class":76},[52,1606,80],{"class":66},[52,1608,380],{"class":135},[52,1610,104],{"class":66},[52,1612,1613],{"class":100},"__dict__",[52,1615,150],{"class":66},[52,1617,1618,1621,1623,1625],{"class":54,"line":119},[52,1619,1620],{"class":76},"help",[52,1622,80],{"class":66},[52,1624,374],{"class":135},[52,1626,150],{"class":66},[14,1628,1629],{},"What these do:",[21,1631,1632,1638,1644,1650],{},[24,1633,1634,1637],{},[49,1635,1636],{},"print(type(my_object))"," shows the object's type",[24,1639,1640,1643],{},[49,1641,1642],{},"print(my_object)"," shows the object representation",[24,1645,1646,1649],{},[49,1647,1648],{},"print(my_object.__dict__)"," shows the object's stored attributes",[24,1651,1652,1655],{},[49,1653,1654],{},"help(ClassName)"," shows information about the class",[14,1657,1658],{},"Example:",[42,1660,1662],{"className":44,"code":1661,"language":46,"meta":47,"style":47},"class Dog:\n    def __init__(self, name):\n        self.name = name\n\nmy_object = Dog(\"Max\")\n\nprint(type(my_object))\nprint(my_object.__dict__)\n",[49,1663,1664,1672,1688,1700,1704,1722,1726,1740],{"__ignoreMap":47},[52,1665,1666,1668,1670],{"class":54,"line":55},[52,1667,59],{"class":58},[52,1669,63],{"class":62},[52,1671,67],{"class":66},[52,1673,1674,1676,1678,1680,1682,1684,1686],{"class":54,"line":70},[52,1675,73],{"class":58},[52,1677,77],{"class":76},[52,1679,80],{"class":66},[52,1681,84],{"class":83},[52,1683,87],{"class":66},[52,1685,91],{"class":90},[52,1687,94],{"class":66},[52,1689,1690,1692,1694,1696,1698],{"class":54,"line":97},[52,1691,101],{"class":100},[52,1693,104],{"class":66},[52,1695,108],{"class":107},[52,1697,112],{"class":111},[52,1699,116],{"class":115},[52,1701,1702],{"class":54,"line":119},[52,1703,123],{"emptyLinePlaceholder":122},[52,1705,1706,1708,1710,1712,1714,1716,1718,1720],{"class":54,"line":126},[52,1707,349],{"class":115},[52,1709,132],{"class":111},[52,1711,63],{"class":135},[52,1713,80],{"class":66},[52,1715,141],{"class":140},[52,1717,145],{"class":144},[52,1719,141],{"class":140},[52,1721,150],{"class":66},[52,1723,1724],{"class":54,"line":153},[52,1725,123],{"emptyLinePlaceholder":122},[52,1727,1728,1730,1732,1734,1736,1738],{"class":54,"line":457},[52,1729,156],{"class":76},[52,1731,80],{"class":66},[52,1733,446],{"class":445},[52,1735,80],{"class":66},[52,1737,380],{"class":135},[52,1739,454],{"class":66},[52,1741,1742,1744,1746,1748,1750,1752],{"class":54,"line":674},[52,1743,156],{"class":76},[52,1745,80],{"class":66},[52,1747,380],{"class":135},[52,1749,104],{"class":66},[52,1751,1613],{"class":100},[52,1753,150],{"class":66},[14,1755,170],{},[42,1757,1759],{"className":44,"code":1758,"language":46,"meta":47,"style":47},"\u003Cclass '__main__.Dog'>\n{'name': 'Max'}\n",[49,1760,1761,1776],{"__ignoreMap":47},[52,1762,1763,1765,1767,1769,1772,1774],{"class":54,"line":55},[52,1764,478],{"class":111},[52,1766,59],{"class":58},[52,1768,483],{"class":140},[52,1770,1771],{"class":144},"__main__.Dog",[52,1773,489],{"class":140},[52,1775,492],{"class":111},[52,1777,1778,1781,1783,1785,1787,1790,1792,1794,1796],{"class":54,"line":70},[52,1779,1780],{"class":66},"{",[52,1782,489],{"class":140},[52,1784,108],{"class":144},[52,1786,489],{"class":140},[52,1788,1789],{"class":66},":",[52,1791,483],{"class":140},[52,1793,145],{"class":144},[52,1795,489],{"class":140},[52,1797,1798],{"class":66},"}\n",[37,1800,1802],{"id":1801},"faq","FAQ",[814,1804,1806],{"id":1805},"what-is-the-difference-between-a-class-and-an-object","What is the difference between a class and an object?",[14,1808,1809],{},"A class is the template. An object is one instance created from that template.",[814,1811,1813,1814,1816],{"id":1812},"do-i-always-need-__init__-to-create-an-object","Do I always need ",[49,1815,279],{}," to create an object?",[14,1818,1819,1820,1822,1823,1825],{},"No. You can create an object without ",[49,1821,279],{},", but ",[49,1824,279],{}," is useful for setting starting values.",[814,1827,1829],{"id":1828},"can-i-create-more-than-one-object-from-the-same-class","Can I create more than one object from the same class?",[14,1831,1832],{},"Yes. Each object is a separate instance and can have different data.",[14,1834,1658],{},[42,1836,1838],{"className":44,"code":1837,"language":46,"meta":47,"style":47},"class Dog:\n    def __init__(self, name):\n        self.name = name\n\ndog1 = Dog(\"Max\")\ndog2 = Dog(\"Bella\")\n\nprint(dog1.name)\nprint(dog2.name)\n",[49,1839,1840,1848,1864,1876,1880,1899,1919,1923,1938],{"__ignoreMap":47},[52,1841,1842,1844,1846],{"class":54,"line":55},[52,1843,59],{"class":58},[52,1845,63],{"class":62},[52,1847,67],{"class":66},[52,1849,1850,1852,1854,1856,1858,1860,1862],{"class":54,"line":70},[52,1851,73],{"class":58},[52,1853,77],{"class":76},[52,1855,80],{"class":66},[52,1857,84],{"class":83},[52,1859,87],{"class":66},[52,1861,91],{"class":90},[52,1863,94],{"class":66},[52,1865,1866,1868,1870,1872,1874],{"class":54,"line":97},[52,1867,101],{"class":100},[52,1869,104],{"class":66},[52,1871,108],{"class":107},[52,1873,112],{"class":111},[52,1875,116],{"class":115},[52,1877,1878],{"class":54,"line":119},[52,1879,123],{"emptyLinePlaceholder":122},[52,1881,1882,1885,1887,1889,1891,1893,1895,1897],{"class":54,"line":126},[52,1883,1884],{"class":115},"dog1 ",[52,1886,132],{"class":111},[52,1888,63],{"class":135},[52,1890,80],{"class":66},[52,1892,141],{"class":140},[52,1894,145],{"class":144},[52,1896,141],{"class":140},[52,1898,150],{"class":66},[52,1900,1901,1904,1906,1908,1910,1912,1915,1917],{"class":54,"line":153},[52,1902,1903],{"class":115},"dog2 ",[52,1905,132],{"class":111},[52,1907,63],{"class":135},[52,1909,80],{"class":66},[52,1911,141],{"class":140},[52,1913,1914],{"class":144},"Bella",[52,1916,141],{"class":140},[52,1918,150],{"class":66},[52,1920,1921],{"class":54,"line":457},[52,1922,123],{"emptyLinePlaceholder":122},[52,1924,1925,1927,1929,1932,1934,1936],{"class":54,"line":674},[52,1926,156],{"class":76},[52,1928,80],{"class":66},[52,1930,1931],{"class":135},"dog1",[52,1933,104],{"class":66},[52,1935,108],{"class":107},[52,1937,150],{"class":66},[52,1939,1940,1942,1944,1947,1949,1951],{"class":54,"line":690},[52,1941,156],{"class":76},[52,1943,80],{"class":66},[52,1945,1946],{"class":135},"dog2",[52,1948,104],{"class":66},[52,1950,108],{"class":107},[52,1952,150],{"class":66},[14,1954,170],{},[42,1956,1958],{"className":44,"code":1957,"language":46,"meta":47,"style":47},"Max\nBella\n",[49,1959,1960,1964],{"__ignoreMap":47},[52,1961,1962],{"class":54,"line":55},[52,1963,173],{"class":115},[52,1965,1966],{"class":54,"line":70},[52,1967,1968],{"class":115},"Bella\n",[814,1970,1972,1973,1976],{"id":1971},"why-do-i-get-a-typeerror-when-creating-an-object","Why do I get a ",[49,1974,1975],{},"TypeError"," when creating an object?",[14,1978,1979,1980,1982],{},"Usually because the arguments passed to the class do not match the ",[49,1981,279],{}," parameters.",[14,1984,1985],{},"For example:",[42,1987,1989],{"className":44,"code":1988,"language":46,"meta":47,"style":47},"class User:\n    def __init__(self, username):\n        self.username = username\n\nuser = User()\n",[49,1990,1991,2000,2017,2031,2035],{"__ignoreMap":47},[52,1992,1993,1995,1998],{"class":54,"line":55},[52,1994,59],{"class":58},[52,1996,1997],{"class":62}," User",[52,1999,67],{"class":66},[52,2001,2002,2004,2006,2008,2010,2012,2015],{"class":54,"line":70},[52,2003,73],{"class":58},[52,2005,77],{"class":76},[52,2007,80],{"class":66},[52,2009,84],{"class":83},[52,2011,87],{"class":66},[52,2013,2014],{"class":90}," username",[52,2016,94],{"class":66},[52,2018,2019,2021,2023,2026,2028],{"class":54,"line":97},[52,2020,101],{"class":100},[52,2022,104],{"class":66},[52,2024,2025],{"class":107},"username",[52,2027,112],{"class":111},[52,2029,2030],{"class":115}," username\n",[52,2032,2033],{"class":54,"line":119},[52,2034,123],{"emptyLinePlaceholder":122},[52,2036,2037,2040,2042,2044],{"class":54,"line":126},[52,2038,2039],{"class":115},"user ",[52,2041,132],{"class":111},[52,2043,1997],{"class":135},[52,2045,432],{"class":66},[14,2047,2048,2049,2051],{},"This fails because ",[49,2050,2025],{}," is missing.",[37,2053,2055],{"id":2054},"see-also","See also",[21,2057,2058,2062,2068,2072,2076,2083],{},[24,2059,2060],{},[249,2061,252],{"href":251},[24,2063,2064],{},[249,2065,1552,2066,798],{"href":794},[49,2067,279],{},[24,2069,2070],{},[249,2071,1559],{"href":1081},[24,2073,2074],{},[249,2075,1564],{"href":1086},[24,2077,2078],{},[249,2079,2080,2081],{"href":1295},"How to fix ",[49,2082,1299],{},[24,2084,2085],{},[249,2086,2087],{"href":256},"What an object is in Python",[14,2089,2090],{},"Next step: learn how classes are structured, then add methods so your objects can do useful work.",[2092,2093,2094],"style",{},"html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sbgvK, html code.shiki .sbgvK{--shiki-light:#E2931D;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sptTA, html code.shiki .sptTA{--shiki-light:#6182B8;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .smCYv, html code.shiki .smCYv{--shiki-light:#E53935;--shiki-light-font-style:italic;--shiki-default:#24292E;--shiki-default-font-style:inherit;--shiki-dark:#E1E4E8;--shiki-dark-font-style:inherit}html pre.shiki code .sFwrP, html code.shiki .sFwrP{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#24292E;--shiki-default-font-style:inherit;--shiki-dark:#E1E4E8;--shiki-dark-font-style:inherit}html pre.shiki code .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .skxfh, html code.shiki .skxfh{--shiki-light:#E53935;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .slqww, html code.shiki .slqww{--shiki-light:#6182B8;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .srjyR, html code.shiki .srjyR{--shiki-light:#90A4AE;--shiki-light-font-style:inherit;--shiki-default:#B31D28;--shiki-default-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}",{"title":47,"searchDepth":70,"depth":70,"links":2096},[2097,2098,2099,2100,2101,2102,2104,2108,2116,2117,2118,2126],{"id":39,"depth":70,"text":40},{"id":185,"depth":70,"text":186},{"id":201,"depth":70,"text":202},{"id":260,"depth":70,"text":261},{"id":392,"depth":70,"text":393},{"id":565,"depth":70,"text":2103},"Create an object with __init__",{"id":801,"depth":70,"text":802,"children":2105},[2106,2107],{"id":816,"depth":97,"text":817},{"id":911,"depth":97,"text":912},{"id":1090,"depth":70,"text":1091,"children":2109},[2110,2111,2112,2114,2115],{"id":1097,"depth":97,"text":1098},{"id":1202,"depth":97,"text":1203},{"id":1302,"depth":97,"text":2113},"Forgetting self inside class methods",{"id":1396,"depth":97,"text":1397},{"id":1486,"depth":97,"text":1487},{"id":1514,"depth":70,"text":1515},{"id":1567,"depth":70,"text":1568},{"id":1801,"depth":70,"text":1802,"children":2119},[2120,2121,2123,2124],{"id":1805,"depth":97,"text":1806},{"id":1812,"depth":97,"text":2122},"Do I always need __init__ to create an object?",{"id":1828,"depth":97,"text":1829},{"id":1971,"depth":97,"text":2125},"Why do I get a TypeError when creating an object?",{"id":2054,"depth":70,"text":2055},"Master how to create an object in python in our comprehensive Python beginner guide.","md",{},"\u002Fhow-to\u002Fhow-to-create-an-object-in-python",{"title":5,"description":2127},"how-to\u002Fhow-to-create-an-object-in-python","ZQhr0150ACRT46vnDZx7TcLggnMH3N8hm8ZK0UQkYIg",1777585504049]