Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The locals dict is lazily created from the locals in the stack frame. No dict there unless you use it. The article I linked to before has a really good explanation of this.

len() only causes one dictionary lookup and then it's cached.

> This is necessary, in general, to deliver on the dynamic lang. features python provides.

It's the most obvious way to implement these features of dynamic languages but not at all necessary.

https://www.infoworld.com/article/2074780/avoiding-hash-look...

https://bibliography.selflanguage.org/_static/pics.pdf



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: