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

Given that most string implementations have both a `len` and `cap` field (or eve just `len`), means that for every string data type, there is one more integer variables being used.

So integer definitely gets used more than strings, and I'd argue way more than floats in most programs.



In CPython, a string's length is stored internally as a machine integer (`Py_ssize_t`); when the `len` builtin is called, the corresponding integer object is created (or more likely, retrieved from cache) on the fly.




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

Search: