[{"data":1,"prerenderedAt":1611},["ShallowReactive",2],{"doc-\u002Ferrors\u002Ftypeerror-list-object-is-not-callable-fix":3},{"id":4,"title":5,"body":6,"description":1604,"extension":1605,"meta":1606,"navigation":111,"path":1607,"seo":1608,"stem":1609,"__hash__":1610},"content\u002Ferrors\u002Ftypeerror-list-object-is-not-callable-fix.md","TypeError: 'list' object is not callable (Fix)",{"type":7,"value":8,"toc":1583},"minimark",[9,19,30,35,119,130,134,140,143,167,170,213,216,252,258,261,301,303,312,321,324,327,348,351,409,412,463,465,474,487,493,499,509,511,556,558,582,585,611,613,657,659,694,697,718,730,734,737,743,745,826,828,852,854,876,878,962,964,989,992,996,999,1021,1024,1100,1103,1148,1151,1155,1158,1187,1190,1272,1275,1364,1367,1396,1403,1407,1410,1448,1451,1455,1458,1481,1490,1494,1499,1505,1509,1514,1522,1531,1535,1538,1542,1579],[10,11,13,14,18],"h1",{"id":12},"typeerror-list-object-is-not-callable-fix","TypeError: ",[15,16,17],"code",{},"'list' object is not callable"," (Fix)",[20,21,22,23,29],"p",{},"Fix the Python error ",[24,25,26],"strong",{},[15,27,28],{},"TypeError: 'list' object is not callable",". This page shows what the error means, the most common causes, and simple ways to correct your code.",[31,32,34],"h2",{"id":33},"quick-fix","Quick fix",[36,37,42],"pre",{"className":38,"code":39,"language":40,"meta":41,"style":41},"language-python shiki shiki-themes material-theme-lighter github-light github-dark","numbers = [1, 2, 3]\nprint(numbers[0])   # correct: use square brackets for indexing\n\n# not numbers(0)\n","python","",[15,43,44,79,106,113],{"__ignoreMap":41},[45,46,49,53,57,61,65,68,71,73,76],"span",{"class":47,"line":48},"line",1,[45,50,52],{"class":51},"su5hD","numbers ",[45,54,56],{"class":55},"smGrS","=",[45,58,60],{"class":59},"sP7_E"," [",[45,62,64],{"class":63},"srdBf","1",[45,66,67],{"class":59},",",[45,69,70],{"class":63}," 2",[45,72,67],{"class":59},[45,74,75],{"class":63}," 3",[45,77,78],{"class":59},"]\n",[45,80,82,86,89,93,96,99,102],{"class":47,"line":81},2,[45,83,85],{"class":84},"sptTA","print",[45,87,88],{"class":59},"(",[45,90,92],{"class":91},"slqww","numbers",[45,94,95],{"class":59},"[",[45,97,98],{"class":63},"0",[45,100,101],{"class":59},"])",[45,103,105],{"class":104},"sutJx","   # correct: use square brackets for indexing\n",[45,107,109],{"class":47,"line":108},3,[45,110,112],{"emptyLinePlaceholder":111},true,"\n",[45,114,116],{"class":47,"line":115},4,[45,117,118],{"class":104},"# not numbers(0)\n",[20,120,121,122,125,126,129],{},"This error usually happens when you use round brackets ",[15,123,124],{},"()"," on a list, or when you overwrite a built-in function name like ",[15,127,128],{},"list",".",[31,131,133],{"id":132},"what-this-error-means","What this error means",[20,135,136,137,129],{},"Python is trying to ",[24,138,139],{},"call a list like a function",[20,141,142],{},"A list and a function use different syntax:",[144,145,146,154,160],"ul",{},[147,148,149,150,153],"li",{},"Lists use square brackets ",[15,151,152],{},"[]"," for indexing",[147,155,156,157,159],{},"Functions use round brackets ",[15,158,124],{}," for calling",[147,161,162,163,166],{},"If a variable holds a list, writing ",[15,164,165],{},"name()"," causes this error",[20,168,169],{},"For example:",[36,171,173],{"className":38,"code":172,"language":40,"meta":41,"style":41},"numbers = [10, 20, 30]\nprint(numbers(0))\n",[15,174,175,198],{"__ignoreMap":41},[45,176,177,179,181,183,186,188,191,193,196],{"class":47,"line":48},[45,178,52],{"class":51},[45,180,56],{"class":55},[45,182,60],{"class":59},[45,184,185],{"class":63},"10",[45,187,67],{"class":59},[45,189,190],{"class":63}," 20",[45,192,67],{"class":59},[45,194,195],{"class":63}," 30",[45,197,78],{"class":59},[45,199,200,202,204,206,208,210],{"class":47,"line":81},[45,201,85],{"class":84},[45,203,88],{"class":59},[45,205,92],{"class":91},[45,207,88],{"class":59},[45,209,98],{"class":63},[45,211,212],{"class":59},"))\n",[20,214,215],{},"Output:",[36,217,219],{"className":38,"code":218,"language":40,"meta":41,"style":41},"TypeError: 'list' object is not callable\n",[15,220,221],{"__ignoreMap":41},[45,222,223,227,230,234,237,240,243,246,249],{"class":47,"line":48},[45,224,226],{"class":225},"sZMiF","TypeError",[45,228,229],{"class":59},":",[45,231,233],{"class":232},"sjJ54"," '",[45,235,128],{"class":236},"s_sjI",[45,238,239],{"class":232},"'",[45,241,242],{"class":225}," object",[45,244,245],{"class":55}," is",[45,247,248],{"class":55}," not",[45,250,251],{"class":84}," callable\n",[20,253,254,255,257],{},"Python raises the error because ",[15,256,92],{}," is a list, not a function.",[20,259,260],{},"If you want the first item, use:",[36,262,264],{"className":38,"code":263,"language":40,"meta":41,"style":41},"numbers = [10, 20, 30]\nprint(numbers[0])\n",[15,265,266,286],{"__ignoreMap":41},[45,267,268,270,272,274,276,278,280,282,284],{"class":47,"line":48},[45,269,52],{"class":51},[45,271,56],{"class":55},[45,273,60],{"class":59},[45,275,185],{"class":63},[45,277,67],{"class":59},[45,279,190],{"class":63},[45,281,67],{"class":59},[45,283,195],{"class":63},[45,285,78],{"class":59},[45,287,288,290,292,294,296,298],{"class":47,"line":81},[45,289,85],{"class":84},[45,291,88],{"class":59},[45,293,92],{"class":91},[45,295,95],{"class":59},[45,297,98],{"class":63},[45,299,300],{"class":59},"])\n",[20,302,215],{},[36,304,306],{"className":38,"code":305,"language":40,"meta":41,"style":41},"10\n",[15,307,308],{"__ignoreMap":41},[45,309,310],{"class":47,"line":48},[45,311,305],{"class":63},[31,313,315,316,318,319],{"id":314},"common-cause-using-instead-of","Common cause: using ",[15,317,124],{}," instead of ",[15,320,152],{},[20,322,323],{},"This is the most common beginner mistake.",[20,325,326],{},"Use square brackets to get an item from a list:",[144,328,329,336,342],{},[147,330,331,332,335],{},"Use ",[15,333,334],{},"my_list[0]"," to get the first item",[147,337,331,338,341],{},[15,339,340],{},"my_list[1]"," to get the second item",[147,343,344,347],{},[15,345,346],{},"my_list(0)"," is invalid because the list is not a function",[20,349,350],{},"Wrong:",[36,352,354],{"className":38,"code":353,"language":40,"meta":41,"style":41},"fruits = [\"apple\", \"banana\", \"cherry\"]\nprint(fruits(1))\n",[15,355,356,394],{"__ignoreMap":41},[45,357,358,361,363,365,368,371,373,375,378,381,383,385,387,390,392],{"class":47,"line":48},[45,359,360],{"class":51},"fruits ",[45,362,56],{"class":55},[45,364,60],{"class":59},[45,366,367],{"class":232},"\"",[45,369,370],{"class":236},"apple",[45,372,367],{"class":232},[45,374,67],{"class":59},[45,376,377],{"class":232}," \"",[45,379,380],{"class":236},"banana",[45,382,367],{"class":232},[45,384,67],{"class":59},[45,386,377],{"class":232},[45,388,389],{"class":236},"cherry",[45,391,367],{"class":232},[45,393,78],{"class":59},[45,395,396,398,400,403,405,407],{"class":47,"line":81},[45,397,85],{"class":84},[45,399,88],{"class":59},[45,401,402],{"class":91},"fruits",[45,404,88],{"class":59},[45,406,64],{"class":63},[45,408,212],{"class":59},[20,410,411],{},"Correct:",[36,413,415],{"className":38,"code":414,"language":40,"meta":41,"style":41},"fruits = [\"apple\", \"banana\", \"cherry\"]\nprint(fruits[1])\n",[15,416,417,449],{"__ignoreMap":41},[45,418,419,421,423,425,427,429,431,433,435,437,439,441,443,445,447],{"class":47,"line":48},[45,420,360],{"class":51},[45,422,56],{"class":55},[45,424,60],{"class":59},[45,426,367],{"class":232},[45,428,370],{"class":236},[45,430,367],{"class":232},[45,432,67],{"class":59},[45,434,377],{"class":232},[45,436,380],{"class":236},[45,438,367],{"class":232},[45,440,67],{"class":59},[45,442,377],{"class":232},[45,444,389],{"class":236},[45,446,367],{"class":232},[45,448,78],{"class":59},[45,450,451,453,455,457,459,461],{"class":47,"line":81},[45,452,85],{"class":84},[45,454,88],{"class":59},[45,456,402],{"class":91},[45,458,95],{"class":59},[45,460,64],{"class":63},[45,462,300],{"class":59},[20,464,215],{},[36,466,468],{"className":38,"code":467,"language":40,"meta":41,"style":41},"banana\n",[15,469,470],{"__ignoreMap":41},[45,471,472],{"class":47,"line":48},[45,473,467],{"class":51},[20,475,476,477,482,483,129],{},"If you need a refresher, see ",[478,479,481],"a",{"href":480},"\u002Flearn\u002Fpython-lists-explained-beginner-guide\u002F","Python lists explained for beginners"," and ",[478,484,486],{"href":485},"\u002Freference\u002Fpython-list-creating-a-list\u002F","how to create a list in Python",[31,488,490,491],{"id":489},"common-cause-naming-a-variable-list","Common cause: naming a variable ",[15,492,128],{},[20,494,495,496,498],{},"Do not use ",[15,497,128],{}," as a variable name.",[20,500,501,502,505,506,508],{},"Python already has a built-in function called ",[15,503,504],{},"list()",". If you assign a list to the name ",[15,507,128],{},", you replace that built-in function in your current scope.",[20,510,350],{},[36,512,514],{"className":38,"code":513,"language":40,"meta":41,"style":41},"list = [1, 2, 3]\nprint(list(\"abc\"))\n",[15,515,516,537],{"__ignoreMap":41},[45,517,518,520,523,525,527,529,531,533,535],{"class":47,"line":48},[45,519,128],{"class":225},[45,521,522],{"class":55}," =",[45,524,60],{"class":59},[45,526,64],{"class":63},[45,528,67],{"class":59},[45,530,70],{"class":63},[45,532,67],{"class":59},[45,534,75],{"class":63},[45,536,78],{"class":59},[45,538,539,541,543,545,547,549,552,554],{"class":47,"line":81},[45,540,85],{"class":84},[45,542,88],{"class":59},[45,544,128],{"class":225},[45,546,88],{"class":59},[45,548,367],{"class":232},[45,550,551],{"class":236},"abc",[45,553,367],{"class":232},[45,555,212],{"class":59},[20,557,215],{},[36,559,560],{"className":38,"code":218,"language":40,"meta":41,"style":41},[15,561,562],{"__ignoreMap":41},[45,563,564,566,568,570,572,574,576,578,580],{"class":47,"line":48},[45,565,226],{"class":225},[45,567,229],{"class":59},[45,569,233],{"class":232},[45,571,128],{"class":236},[45,573,239],{"class":232},[45,575,242],{"class":225},[45,577,245],{"class":55},[45,579,248],{"class":55},[45,581,251],{"class":84},[20,583,584],{},"Why this happens:",[144,586,587,595,604],{},[147,588,589,592,593],{},[15,590,591],{},"list = [1, 2, 3]"," stores a list in the name ",[15,594,128],{},[147,596,597,598,600,601,603],{},"After that, ",[15,599,128],{}," no longer refers to the built-in ",[15,602,504],{}," function",[147,605,606,607,610],{},"So ",[15,608,609],{},"list(\"abc\")"," tries to call a list object",[20,612,411],{},[36,614,616],{"className":38,"code":615,"language":40,"meta":41,"style":41},"items = [1, 2, 3]\nprint(list(\"abc\"))\n",[15,617,618,639],{"__ignoreMap":41},[45,619,620,623,625,627,629,631,633,635,637],{"class":47,"line":48},[45,621,622],{"class":51},"items ",[45,624,56],{"class":55},[45,626,60],{"class":59},[45,628,64],{"class":63},[45,630,67],{"class":59},[45,632,70],{"class":63},[45,634,67],{"class":59},[45,636,75],{"class":63},[45,638,78],{"class":59},[45,640,641,643,645,647,649,651,653,655],{"class":47,"line":81},[45,642,85],{"class":84},[45,644,88],{"class":59},[45,646,128],{"class":225},[45,648,88],{"class":59},[45,650,367],{"class":232},[45,652,551],{"class":236},[45,654,367],{"class":232},[45,656,212],{"class":59},[20,658,215],{},[36,660,662],{"className":38,"code":661,"language":40,"meta":41,"style":41},"['a', 'b', 'c']\n",[15,663,664],{"__ignoreMap":41},[45,665,666,668,670,672,674,676,678,681,683,685,687,690,692],{"class":47,"line":48},[45,667,95],{"class":59},[45,669,239],{"class":232},[45,671,478],{"class":236},[45,673,239],{"class":232},[45,675,67],{"class":59},[45,677,233],{"class":232},[45,679,680],{"class":236},"b",[45,682,239],{"class":232},[45,684,67],{"class":59},[45,686,233],{"class":232},[45,688,689],{"class":236},"c",[45,691,239],{"class":232},[45,693,78],{"class":59},[20,695,696],{},"Better variable names:",[144,698,699,704,708,713],{},[147,700,701],{},[15,702,703],{},"items",[147,705,706],{},[15,707,92],{},[147,709,710],{},[15,711,712],{},"values",[147,714,715],{},[15,716,717],{},"names",[20,719,720,721,729],{},"You can learn more about checking object types on the ",[478,722,724,725,728],{"href":723},"\u002Freference\u002Fpython-type-function-explained\u002F","Python ",[15,726,727],{},"type()"," function explained"," page.",[31,731,733],{"id":732},"common-cause-reusing-a-function-name-for-a-list","Common cause: reusing a function name for a list",[20,735,736],{},"You may create a function, then later assign a list to the same name.",[20,738,739,740,742],{},"After that, calling the name with ",[15,741,124],{}," fails.",[20,744,350],{},[36,746,748],{"className":38,"code":747,"language":40,"meta":41,"style":41},"def get_numbers():\n    return [1, 2, 3]\n\nget_numbers = [10, 20, 30]\n\nprint(get_numbers())\n",[15,749,750,763,783,787,808,813],{"__ignoreMap":41},[45,751,752,756,760],{"class":47,"line":48},[45,753,755],{"class":754},"sbsja","def",[45,757,759],{"class":758},"sGLFI"," get_numbers",[45,761,762],{"class":59},"():\n",[45,764,765,769,771,773,775,777,779,781],{"class":47,"line":81},[45,766,768],{"class":767},"sVHd0","    return",[45,770,60],{"class":59},[45,772,64],{"class":63},[45,774,67],{"class":59},[45,776,70],{"class":63},[45,778,67],{"class":59},[45,780,75],{"class":63},[45,782,78],{"class":59},[45,784,785],{"class":47,"line":108},[45,786,112],{"emptyLinePlaceholder":111},[45,788,789,792,794,796,798,800,802,804,806],{"class":47,"line":115},[45,790,791],{"class":51},"get_numbers ",[45,793,56],{"class":55},[45,795,60],{"class":59},[45,797,185],{"class":63},[45,799,67],{"class":59},[45,801,190],{"class":63},[45,803,67],{"class":59},[45,805,195],{"class":63},[45,807,78],{"class":59},[45,809,811],{"class":47,"line":810},5,[45,812,112],{"emptyLinePlaceholder":111},[45,814,816,818,820,823],{"class":47,"line":815},6,[45,817,85],{"class":84},[45,819,88],{"class":59},[45,821,822],{"class":91},"get_numbers",[45,824,825],{"class":59},"())\n",[20,827,215],{},[36,829,830],{"className":38,"code":218,"language":40,"meta":41,"style":41},[15,831,832],{"__ignoreMap":41},[45,833,834,836,838,840,842,844,846,848,850],{"class":47,"line":48},[45,835,226],{"class":225},[45,837,229],{"class":59},[45,839,233],{"class":232},[45,841,128],{"class":236},[45,843,239],{"class":232},[45,845,242],{"class":225},[45,847,245],{"class":55},[45,849,248],{"class":55},[45,851,251],{"class":84},[20,853,584],{},[144,855,856,862,869],{},[147,857,858,859,861],{},"At first, ",[15,860,822],{}," is a function",[147,863,864,865,868],{},"Later, ",[15,866,867],{},"get_numbers = [10, 20, 30]"," replaces that function with a list",[147,870,871,872,875],{},"Then ",[15,873,874],{},"get_numbers()"," tries to call the list",[20,877,411],{},[36,879,881],{"className":38,"code":880,"language":40,"meta":41,"style":41},"def get_numbers():\n    return [1, 2, 3]\n\nnumbers = [10, 20, 30]\n\nprint(get_numbers())\nprint(numbers[0])\n",[15,882,883,891,909,913,933,937,947],{"__ignoreMap":41},[45,884,885,887,889],{"class":47,"line":48},[45,886,755],{"class":754},[45,888,759],{"class":758},[45,890,762],{"class":59},[45,892,893,895,897,899,901,903,905,907],{"class":47,"line":81},[45,894,768],{"class":767},[45,896,60],{"class":59},[45,898,64],{"class":63},[45,900,67],{"class":59},[45,902,70],{"class":63},[45,904,67],{"class":59},[45,906,75],{"class":63},[45,908,78],{"class":59},[45,910,911],{"class":47,"line":108},[45,912,112],{"emptyLinePlaceholder":111},[45,914,915,917,919,921,923,925,927,929,931],{"class":47,"line":115},[45,916,52],{"class":51},[45,918,56],{"class":55},[45,920,60],{"class":59},[45,922,185],{"class":63},[45,924,67],{"class":59},[45,926,190],{"class":63},[45,928,67],{"class":59},[45,930,195],{"class":63},[45,932,78],{"class":59},[45,934,935],{"class":47,"line":810},[45,936,112],{"emptyLinePlaceholder":111},[45,938,939,941,943,945],{"class":47,"line":815},[45,940,85],{"class":84},[45,942,88],{"class":59},[45,944,822],{"class":91},[45,946,825],{"class":59},[45,948,950,952,954,956,958,960],{"class":47,"line":949},7,[45,951,85],{"class":84},[45,953,88],{"class":59},[45,955,92],{"class":91},[45,957,95],{"class":59},[45,959,98],{"class":63},[45,961,300],{"class":59},[20,963,215],{},[36,965,967],{"className":38,"code":966,"language":40,"meta":41,"style":41},"[1, 2, 3]\n10\n",[15,968,969,985],{"__ignoreMap":41},[45,970,971,973,975,977,979,981,983],{"class":47,"line":48},[45,972,95],{"class":59},[45,974,64],{"class":63},[45,976,67],{"class":59},[45,978,70],{"class":63},[45,980,67],{"class":59},[45,982,75],{"class":63},[45,984,78],{"class":59},[45,986,987],{"class":47,"line":81},[45,988,305],{"class":63},[20,990,991],{},"If the error started after you renamed or reassigned something, check the lines above the traceback carefully.",[31,993,995],{"id":994},"how-to-fix-it","How to fix it",[20,997,998],{},"Use the fix that matches your situation:",[144,1000,1001,1010,1015,1018],{},[147,1002,1003,1004,1006,1007,1009],{},"Replace ",[15,1005,124],{}," with ",[15,1008,152],{}," when accessing list items",[147,1011,1012,1013],{},"Rename variables that shadow built-in names like ",[15,1014,128],{},[147,1016,1017],{},"Rename variables that reuse function names",[147,1019,1020],{},"Restart your interpreter or notebook if an old bad assignment still exists",[20,1022,1023],{},"Example fix for indexing:",[36,1025,1027],{"className":38,"code":1026,"language":40,"meta":41,"style":41},"letters = [\"a\", \"b\", \"c\"]\n\n# wrong:\n# print(letters(0))\n\n# correct:\nprint(letters[0])\n",[15,1028,1029,1062,1066,1071,1076,1080,1085],{"__ignoreMap":41},[45,1030,1031,1034,1036,1038,1040,1042,1044,1046,1048,1050,1052,1054,1056,1058,1060],{"class":47,"line":48},[45,1032,1033],{"class":51},"letters ",[45,1035,56],{"class":55},[45,1037,60],{"class":59},[45,1039,367],{"class":232},[45,1041,478],{"class":236},[45,1043,367],{"class":232},[45,1045,67],{"class":59},[45,1047,377],{"class":232},[45,1049,680],{"class":236},[45,1051,367],{"class":232},[45,1053,67],{"class":59},[45,1055,377],{"class":232},[45,1057,689],{"class":236},[45,1059,367],{"class":232},[45,1061,78],{"class":59},[45,1063,1064],{"class":47,"line":81},[45,1065,112],{"emptyLinePlaceholder":111},[45,1067,1068],{"class":47,"line":108},[45,1069,1070],{"class":104},"# wrong:\n",[45,1072,1073],{"class":47,"line":115},[45,1074,1075],{"class":104},"# print(letters(0))\n",[45,1077,1078],{"class":47,"line":810},[45,1079,112],{"emptyLinePlaceholder":111},[45,1081,1082],{"class":47,"line":815},[45,1083,1084],{"class":104},"# correct:\n",[45,1086,1087,1089,1091,1094,1096,1098],{"class":47,"line":949},[45,1088,85],{"class":84},[45,1090,88],{"class":59},[45,1092,1093],{"class":91},"letters",[45,1095,95],{"class":59},[45,1097,98],{"class":63},[45,1099,300],{"class":59},[20,1101,1102],{},"Example fix for a shadowed built-in:",[36,1104,1106],{"className":38,"code":1105,"language":40,"meta":41,"style":41},"values = [1, 2, 3]\nprint(list(\"hi\"))\n",[15,1107,1108,1129],{"__ignoreMap":41},[45,1109,1110,1113,1115,1117,1119,1121,1123,1125,1127],{"class":47,"line":48},[45,1111,1112],{"class":51},"values ",[45,1114,56],{"class":55},[45,1116,60],{"class":59},[45,1118,64],{"class":63},[45,1120,67],{"class":59},[45,1122,70],{"class":63},[45,1124,67],{"class":59},[45,1126,75],{"class":63},[45,1128,78],{"class":59},[45,1130,1131,1133,1135,1137,1139,1141,1144,1146],{"class":47,"line":81},[45,1132,85],{"class":84},[45,1134,88],{"class":59},[45,1136,128],{"class":225},[45,1138,88],{"class":59},[45,1140,367],{"class":232},[45,1142,1143],{"class":236},"hi",[45,1145,367],{"class":232},[45,1147,212],{"class":59},[20,1149,1150],{},"If you are working in Jupyter, IPython, or a Python shell, restarting can help after you fix the code. Old variable assignments may still be stored in memory.",[31,1152,1154],{"id":1153},"step-by-step-debugging","Step-by-step debugging",[20,1156,1157],{},"When you see this error, use these steps:",[1159,1160,1161,1164,1169,1172,1178],"ol",{},[147,1162,1163],{},"Read the exact line named in the traceback",[147,1165,1166,1167],{},"Look for a name followed by ",[15,1168,124],{},[147,1170,1171],{},"Check what that name currently stores",[147,1173,331,1174,1177],{},[15,1175,1176],{},"print(type(name))"," if you are unsure",[147,1179,1180,1181,1184,1185],{},"If the result is ",[15,1182,1183],{},"\u003Cclass 'list'>",", do not call it with ",[15,1186,124],{},[20,1188,1189],{},"Useful debugging commands:",[36,1191,1193],{"className":38,"code":1192,"language":40,"meta":41,"style":41},"my_list = [1, 2, 3]\n\nprint(type(my_list))\nprint(my_list)\nprint(type(list))\nprint(dir())\n",[15,1194,1195,1216,1220,1236,1247,1261],{"__ignoreMap":41},[45,1196,1197,1200,1202,1204,1206,1208,1210,1212,1214],{"class":47,"line":48},[45,1198,1199],{"class":51},"my_list ",[45,1201,56],{"class":55},[45,1203,60],{"class":59},[45,1205,64],{"class":63},[45,1207,67],{"class":59},[45,1209,70],{"class":63},[45,1211,67],{"class":59},[45,1213,75],{"class":63},[45,1215,78],{"class":59},[45,1217,1218],{"class":47,"line":81},[45,1219,112],{"emptyLinePlaceholder":111},[45,1221,1222,1224,1226,1229,1231,1234],{"class":47,"line":108},[45,1223,85],{"class":84},[45,1225,88],{"class":59},[45,1227,1228],{"class":225},"type",[45,1230,88],{"class":59},[45,1232,1233],{"class":91},"my_list",[45,1235,212],{"class":59},[45,1237,1238,1240,1242,1244],{"class":47,"line":115},[45,1239,85],{"class":84},[45,1241,88],{"class":59},[45,1243,1233],{"class":91},[45,1245,1246],{"class":59},")\n",[45,1248,1249,1251,1253,1255,1257,1259],{"class":47,"line":810},[45,1250,85],{"class":84},[45,1252,88],{"class":59},[45,1254,1228],{"class":225},[45,1256,88],{"class":59},[45,1258,128],{"class":225},[45,1260,212],{"class":59},[45,1262,1263,1265,1267,1270],{"class":47,"line":815},[45,1264,85],{"class":84},[45,1266,88],{"class":59},[45,1268,1269],{"class":84},"dir",[45,1271,825],{"class":59},[20,1273,1274],{},"Example output:",[36,1276,1278],{"className":38,"code":1277,"language":40,"meta":41,"style":41},"\u003Cclass 'list'>\n[1, 2, 3]\n\u003Cclass 'type'>\n['__annotations__', '__builtins__', '__doc__', ...]\n",[15,1279,1280,1297,1313,1327],{"__ignoreMap":41},[45,1281,1282,1285,1288,1290,1292,1294],{"class":47,"line":48},[45,1283,1284],{"class":55},"\u003C",[45,1286,1287],{"class":754},"class",[45,1289,233],{"class":232},[45,1291,128],{"class":236},[45,1293,239],{"class":232},[45,1295,1296],{"class":55},">\n",[45,1298,1299,1301,1303,1305,1307,1309,1311],{"class":47,"line":81},[45,1300,95],{"class":59},[45,1302,64],{"class":63},[45,1304,67],{"class":59},[45,1306,70],{"class":63},[45,1308,67],{"class":59},[45,1310,75],{"class":63},[45,1312,78],{"class":59},[45,1314,1315,1317,1319,1321,1323,1325],{"class":47,"line":108},[45,1316,1284],{"class":55},[45,1318,1287],{"class":754},[45,1320,233],{"class":232},[45,1322,1228],{"class":236},[45,1324,239],{"class":232},[45,1326,1296],{"class":55},[45,1328,1329,1331,1333,1336,1338,1340,1342,1345,1347,1349,1351,1354,1356,1358,1362],{"class":47,"line":115},[45,1330,95],{"class":59},[45,1332,239],{"class":232},[45,1334,1335],{"class":236},"__annotations__",[45,1337,239],{"class":232},[45,1339,67],{"class":59},[45,1341,233],{"class":232},[45,1343,1344],{"class":236},"__builtins__",[45,1346,239],{"class":232},[45,1348,67],{"class":59},[45,1350,233],{"class":232},[45,1352,1353],{"class":236},"__doc__",[45,1355,239],{"class":232},[45,1357,67],{"class":59},[45,1359,1361],{"class":1360},"s_hVV"," ...",[45,1363,78],{"class":59},[20,1365,1366],{},"What these commands help you find:",[144,1368,1369,1375,1381,1390],{},[147,1370,1371,1374],{},[15,1372,1373],{},"print(type(my_list))"," shows whether a variable is a list",[147,1376,1377,1380],{},[15,1378,1379],{},"print(my_list)"," shows the actual value",[147,1382,1383,1386,1387,1389],{},[15,1384,1385],{},"print(type(list))"," helps you check whether ",[15,1388,128],{}," still refers to the built-in",[147,1391,1392,1395],{},[15,1393,1394],{},"dir()"," shows names currently defined in your scope",[20,1397,1398,1399,129],{},"If you want more help reading tracebacks and checking variables, see this ",[478,1400,1402],{"href":1401},"\u002Fhow-to\u002Fhow-to-debug-python-code-beginner-guide\u002F","beginner guide to debugging Python code",[31,1404,1406],{"id":1405},"how-to-avoid-this-error","How to avoid this error",[20,1408,1409],{},"A few habits can prevent this problem:",[144,1411,1412,1420,1436,1445],{},[147,1413,1414,1415,1417,1418],{},"Use clear variable names like ",[15,1416,1233],{}," or ",[15,1419,92],{},[147,1421,1422,1423,1425,1426,1425,1429,1432,1433],{},"Do not name variables ",[15,1424,128],{},", ",[15,1427,1428],{},"str",[15,1430,1431],{},"dict",", or ",[15,1434,1435],{},"set",[147,1437,1438,1439,1441,1442,1444],{},"Remember: ",[15,1440,152],{}," accesses items, ",[15,1443,124],{}," calls functions",[147,1446,1447],{},"Test small pieces of code as you write them",[20,1449,1450],{},"This is especially important in notebooks and interactive shells, where old assignments can stay around longer than you expect.",[31,1452,1454],{"id":1453},"common-mistakes","Common mistakes",[20,1456,1457],{},"These are the most common reasons for this error:",[144,1459,1460,1467,1475,1478],{},[147,1461,1462,1463,318,1465],{},"Using ",[15,1464,346],{},[15,1466,334],{},[147,1468,1469,1470,1472,1473],{},"Assigning a list to the name ",[15,1471,128],{}," and then calling ",[15,1474,504],{},[147,1476,1477],{},"Overwriting a function name with a list",[147,1479,1480],{},"Keeping an old variable assignment in a notebook or interactive shell",[20,1482,1483,1484,129],{},"A related error can happen with dictionaries too. See ",[478,1485,13,1487],{"href":1486},"\u002Ferrors\u002Ftypeerror-dict-object-is-not-callable-fix\u002F",[15,1488,1489],{},"'dict' object is not callable",[31,1491,1493],{"id":1492},"faq","FAQ",[1495,1496,1498],"h3",{"id":1497},"why-does-python-say-a-list-is-not-callable","Why does Python say a list is not callable?",[20,1500,1501,1502,1504],{},"Because only functions and other callable objects can be used with ",[15,1503,124],{},". A list cannot be called like a function.",[1495,1506,1508],{"id":1507},"how-do-i-get-an-item-from-a-list-correctly","How do I get an item from a list correctly?",[20,1510,1511,1512,129],{},"Use square brackets with an index, like ",[15,1513,334],{},[1495,1515,1517,1518,1521],{"id":1516},"why-did-listabc-stop-working","Why did ",[15,1519,1520],{},"list('abc')"," stop working?",[20,1523,1524,1525,1527,1528,1530],{},"You probably assigned a list to the name ",[15,1526,128],{}," earlier, which replaced the built-in ",[15,1529,504],{}," function in your current scope.",[1495,1532,1534],{"id":1533},"do-i-need-to-restart-python-after-fixing-the-name","Do I need to restart Python after fixing the name?",[20,1536,1537],{},"Sometimes yes, especially in notebooks or interactive shells where the bad assignment still exists.",[31,1539,1541],{"id":1540},"see-also","See also",[144,1543,1544,1548,1553,1559,1564,1570],{},[147,1545,1546],{},[478,1547,481],{"href":480},[147,1549,1550],{},[478,1551,1552],{"href":485},"How to create a list in Python",[147,1554,1555],{},[478,1556,724,1557,728],{"href":723},[15,1558,727],{},[147,1560,1561],{},[478,1562,1563],{"href":1401},"Beginner guide to debugging Python code",[147,1565,1566],{},[478,1567,13,1568],{"href":1486},[15,1569,1489],{},[147,1571,1572],{},[478,1573,1575,1576],{"href":1574},"\u002Ferrors\u002Fattributeerror-list-object-has-no-attribute-fix\u002F","AttributeError: ",[15,1577,1578],{},"'list' object has no attribute ...",[1580,1581,1582],"style",{},"html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--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 .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sptTA, html code.shiki .sptTA{--shiki-light:#6182B8;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .slqww, html code.shiki .slqww{--shiki-light:#6182B8;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sutJx, html code.shiki .sutJx{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}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 .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--shiki-default:#005CC5;--shiki-dark:#79B8FF}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 pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}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 .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":41,"searchDepth":81,"depth":81,"links":1584},[1585,1586,1587,1589,1591,1592,1593,1594,1595,1596,1603],{"id":33,"depth":81,"text":34},{"id":132,"depth":81,"text":133},{"id":314,"depth":81,"text":1588},"Common cause: using () instead of []",{"id":489,"depth":81,"text":1590},"Common cause: naming a variable list",{"id":732,"depth":81,"text":733},{"id":994,"depth":81,"text":995},{"id":1153,"depth":81,"text":1154},{"id":1405,"depth":81,"text":1406},{"id":1453,"depth":81,"text":1454},{"id":1492,"depth":81,"text":1493,"children":1597},[1598,1599,1600,1602],{"id":1497,"depth":108,"text":1498},{"id":1507,"depth":108,"text":1508},{"id":1516,"depth":108,"text":1601},"Why did list('abc') stop working?",{"id":1533,"depth":108,"text":1534},{"id":1540,"depth":81,"text":1541},"Master typeerror list object is not callable fix in our comprehensive Python beginner guide.","md",{},"\u002Ferrors\u002Ftypeerror-list-object-is-not-callable-fix",{"title":5,"description":1604},"errors\u002Ftypeerror-list-object-is-not-callable-fix","qI3OK9oRGdLzaEM29WSCKiPN10NC_C4OEkqWvfHWREM",1777585481068]