[{"data":1,"prerenderedAt":225},["ShallowReactive",2],{"project-18754010":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":31,"aspects":33,"strip":35,"post_text":29,"what":37,"said":56,"maker_in_thread":114,"shape":122,"grid":127,"attempts":187,"same_week":188,"maker_shows":217,"maker_hidden":218,"reader_version":219,"card":220},"18754010","Inside Python Dict","an explorable explanation","title","Show HN: Inside Python Dict – an explorable explanation","https:\u002F\u002Fjust-taking-a-ride.com\u002Finside_python_dict\u002F","just-taking-a-ride.com","eatitraw",1545682139,2018,111,27,392,2155,19,"notable","learning_science","interactive explainer","web_app",[24,25,26,27],"python dict","hash table","python internals","cpython","quiet",null,{"positive":31,"neutral":32,"mixed":32,"critical":32},1,0,{"docs":34},{"positive":31,"critical":32},[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,36,32],5,{"problem":38,"audience":44,"pricing":29,"motivation":29,"time_to_build":29,"stack":54,"openness":55,"stage":55,"team_size":55},{"value":39,"source":40,"evidence":41},"Explains how Python dictionaries are implemented internally","inferred",[42],{"id":43},"post",{"value":45,"source":40,"evidence":46},"Python programmers curious about internals",[47,51],{"id":48,"by":49,"text":50},"18756573","stinos","Python lists are actually arrays — contiguous chunks of memory. Just wondering here, is this guaranteed to always be the case? Practically it probably is, but does the Python…",{"id":52,"by":11,"text":53},"18757610","I think you have a point about C or C++ notion of arrays having the same type. I'll probably rewrite that paragraph, since the main point is to tell people unfamiliar with Python…",[],"unknown",{"praise":57,"objections":69,"requests":85,"questions":93,"alternatives":106},[58],{"value":59,"source":60,"evidence":61},"Helpful for understanding Python internals and list implementation","commenter",[62,66],{"id":63,"by":64,"text":65},"18757702","Waterluvian","So... Because lists are dynamically typed and heterogeneous, does that mean the underlying C is basically a contiguous segment of memory of python object references? Then in…",{"id":67,"by":64,"text":68},"18757925","I keep forgetting just how readable cpython source is. I'm still mentally stuck in my beginner years, where it was all Greek to me. Thanks for sharing these links.",[70],{"value":71,"source":60,"evidence":72},"Calling Python lists arrays is misleading; they hold pointers to objects",[73,77,81],{"id":74,"by":75,"text":76},"18757486","joatmon-snoo","Strictly speaking, lists are not arrays. I'm not aware of what the specification for a list would be, this is the closest I'm aware of:…",{"id":78,"by":79,"text":80},"18757726","_ZeD_","No, they are not. At \"best\" they are implemented \"like\" an array of pointers to the objects (scattered somewhere else in the memory) in the list. If you want an array (in the…",{"id":82,"by":83,"text":84},"18758255","black-tea","It's not implemented like that and couldn't be. They aren't arrays unless you consider them arrays of pointers but this isn't a useful definition in Python. An array contains a…",[86],{"value":87,"source":60,"evidence":88},"Clarify the wording about lists being arrays and check implementation differences across Python implementations",[89,90],{"id":48,"by":49,"text":50},{"id":91,"by":11,"text":92},"18757019","It is indexable, and it is used as an array, so I guess it is an array in all implementations. But good point, I should check this. Dicts are definktely implemented differently…",[94],{"value":95,"source":60,"evidence":96},"Is a Python list an array, and is its contiguous layout guaranteed by the language spec or only CPython?",[97,98,102],{"id":48,"by":49,"text":50},{"id":99,"by":100,"text":101},"18756722","lozenge","Python doesn't really have a spec in the way that, say, C# does. The docs are missing things like whether the argument is positional-only, exact exceptions raised in all cases,…",{"id":103,"by":104,"text":105},"18757399","johnisgood","According to this post: https:\u002F\u002Fnews.ycombinator.com\u002Fitem?id=18707403, \"Lists aren't called arrays in Python because they're not arrays. Next!\". I really am confused now. Is it…",[107],{"value":108,"source":60,"evidence":109},"Python array.array module",[110],{"id":111,"by":112,"text":113},"18758335","dorfsmay","If you want some closer to C arrays, you can use Python array.array, which is part of the standard library. https:\u002F\u002Fdocs.python.org\u002F3\u002Flibrary\u002Farray.html…",{"comments":36,"answered":115,"key":116},4,[117,118,119],{"id":91,"text":92},{"id":52,"text":53},{"id":120,"text":121},"18757756","> Because lists are dynamically typed and heterogeneous, does that mean the underlying C is basically a contiguous segment of memory of python object references? Yep, it is an…",{"commenters":123,"max_depth":124,"maker_replies":36,"first_comment_mins":125,"lifespan_hours":126},20,8,725,164,[128,130,131,134,137,139,140,141,144,145,147,149,150,153,157,158,159,162,164,167,169,170,173,176,177,179,183],[48,32,32,129,49,32],"commenter\u002Fneutral\u002Fnone",[99,32,32,129,100,32],[132,32,32,129,133,32],"18757356","mlthoughts2018",[135,32,32,129,136,32],"18756723","chrisseaton",[91,32,32,138,11,31],"maker\u002Fneutral\u002Fnone",[103,32,32,129,104,32],[74,32,32,129,75,32],[142,32,32,129,143,32],"18757585","webmaven",[111,32,32,129,112,32],[146,32,32,129,143,32],"18795034",[52,32,32,148,11,31],"maker\u002Fneutral\u002Fdocs",[63,32,32,129,64,32],[151,32,32,129,152,32],"18757728","haikuginger",[154,32,32,155,156,32],"18759238","other\u002Fneutral\u002Fnone","aggerdom",[120,32,32,138,11,31],[67,32,32,155,64,32],[160,32,32,155,161,32],"18758604","mcguire",[163,32,32,155,11,31],"18758634",[165,32,32,155,166,32],"18765840","rurban",[168,32,32,129,11,31],"18757646",[78,32,32,129,79,32],[171,32,32,129,172,32],"18758785","c3534l",[174,32,32,129,175,32],"18758901","noobiemcfoob",[82,32,32,129,83,32],[178,32,32,129,161,32],"18758531",[180,31,36,181,182,32],"18758185","project\u002Fpositive\u002Fdocs","whoisnnamdi",[184,185,32,155,186,32],"18756531",2,"deepakg",[],[189,194,199,203,208,213],{"id":190,"name":191,"points":192,"category":193},"18738275","curves",341,"creative",{"id":195,"name":196,"points":197,"category":198},"18755782","Wiv.js",265,"languages",{"id":200,"name":201,"points":202,"category":198},"18750561","Magic Grid",167,{"id":204,"name":205,"points":206,"category":207},"18765482","Notable",124,"productivity",{"id":209,"name":210,"points":211,"category":212},"18725485","Serverless Analytics (Statsbot \u002F Cube.js)",114,"data",{"id":214,"name":215,"points":216,"category":198},"18761359","lambdatalk FFT",100,3,false,"v2",{"id":221,"name":5,"line":6,"ai":218,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":29,"top":18,"kw":222,"maker":11,"domain":10,"tier":19,"attempts":32,"strip":223,"url":9,"mix":224,"praise":59,"objection":71,"sub":21},18754010,[24,25,26,27],"000000000000000000000000050",[31,32,32,32],1793990983686]